Dynamic Autorun Help

Ok…
Take Some Deep Breaths…
I NEED SOME GO DAM HELP! HALF MY WILD CARDS DONT WORK AND I THINK ITS MAKING MY IQ LOWER SO I AM MAKING MISTAKES! I HAVE BEEN AT IT FOR 3 DAYS!
More Deep Breaths…
And Calm.

Code:



-- Client/Shared Push
if CLIENT then
 for k,v in pairs(table) do
  include( "ev_core/client/cl_*.lua" )
  include( "ev_core/shared/sh_*.lua" )
  AddCSLuaFile( "ev_core/client/cl_*.lua" )
  AddCSLuaFile( "ev_core/shared/sh_*.lua" )
  
  print( "Done Client!" )
 end 
end 

-- Shared/Server Push
if SERVER then
 for k,v in pairs(table) do
  AddCSLuaFile( "ev_core/client/cl_*.lua" )
  AddCSLuaFile( "ev_core/shared/sh_*.lua" )
  include( "ev_core/shared/sh_*.lua" )
  include( "ev_core/server/sv_*.lua" )
  print( "Done Server!" )
 end 
end




Please could someone fix my wildcards and/or fix any other errors!
You will be mentioned in sh_credits.lua under convar +ev_showcredits!

Thank you!
Any help will be worshiped!



if CLIENT then
 for k,v in pairs(table) do
  include( "ev_core/client/cl_*.lua" )
  include( "ev_core/shared/sh_*.lua" )
  AddCSLuaFile( "ev_core/client/cl_*.lua" )
  AddCSLuaFile( "ev_core/shared/sh_*.lua" )
  
  print( "Done Client!" )
 end 
end 

You can’t AddCSLuaFile on the client.

You use include in the client section.

Ok, now can someone tell me why I can do this:


AddCSLua( "sh_*.lua" )

but not this:


include( "sh_*.lua" )

which actually looks for a file named sh_* instead of ones prefixed with that!

Haven’t ever actually tested but, include probably doesn’t support wildcarding. You’ll have to use file.FindInLua

file.FindInLua you say? Whips out gmod wiki and starts researching

Thanks!

[editline]11th July 2012[/editline]

Ok, so… um… kinda like this?




-- Client/Shared Push
if CLIENT then
 for k,v in pairs(table) do
  local cl_list = file.FindInLua("ev_core/client/*.lua")
  for _, file in pairs(list) do
   include(file)
  end

  local sh_list = file.FindInLua("ev_core/shared/*.lua")
  for _, file in pairs(list) do
   include(file)
  end
  
  print( "Done Client!" )
 end 
end 

-- Shared/Server Push
if SERVER then
 for k,v in pairs(table) do
  AddCSLuaFile( "ev_core/client/cl_*.lua" )
  AddCSLuaFile( "ev_core/shared/sh_*.lua" )
 
  local sh_list = file.FindInLua("ev_core/shared/*.lua")
  for _, file in pairs(list) do
   include(file)
  end

  local sv_list = file.FindInLua("ev_core/server/*.lua")
  for _, file in pairs(list) do
   include(file)
  end
  
  print( "Done Server!" )
 end 
end


Would this work?
Thanks

[lua]
–Gmod 12:
file.FindInLua("<SOMEGAMEMODE>/gamemode/client/*.lua");

–Gmod 13:
file.Find("<SOMEGAMEMODE>/gamemode/client/*.lua", LUA_PATH)

[/lua]

I used Gmod 13’s file.Find below.

On the server portion:

[lua]

–Client
for k,v in pairs (file.Find("<SOMEGAMEMODE>/gamemode/client/*.lua", LUA_PATH)) do
Msg(“Client File Added: " … v … "
“);
AddCSLuaFile(”<SOMEGAMEMODE>/gamemode/client/” … v);
end

–Shared
for k,v in pairs (file.Find("<SOMEGAMEMODE>/gamemode/shared/*.lua", LUA_PATH)) do
Msg(“Shared File Added/Loaded: " … v … "
“);
include(”<SOMEGAMEMODE>/gamemode/shared/” … v);
AddCSLuaFile("<SOMEGAMEMODE>/gamemode/shared/" … v);
end

–Server
for k,v in pairs (file.Find("<SOMEGAMEMODE>/gamemode/server/*.lua", LUA_PATH)) do
Msg(“Server File Loaded: " … v … "
“);
include(”<SOMEGAMEMODE>/gamemode/server/” … v);
end

[/lua]

On the client portion:

[lua]

//Client
for k,v in pairs (file.Find("<SOMEGAMEMODE>/gamemode/client/*.lua", LUA_PATH)) do
Msg(“Client File Loaded: " … v … "
“);
include(”<SOMEGAMEMODE>/gamemode/client/” … v);
end

//Shared…
for k,v in pairs (file.Find("<SOMEGAMEMODE>/gamemode/shared/*.lua", LUA_PATH)) do
Msg(“Client File Loaded: " … v … "
“);
include(”<SOMEGAMEMODE>/gamemode/shared/” … v);
end

[/lua]

THIS IS WHY YOU ARE GOD!

All I have to say is:

for i=1,9000 do
Msg("TANKYOU
")
end