So I have the following code:
//Include them all
util.IncludeFolder( "jobs" )
util.AddCSLuaFiles( "jobs" )
Which is supposed to include everything in a folder and also send it to the client:
function util.IncludeFolder( path )
for k, v in pairs( file.Find( "../"..GM.Folder.."/gamemode/"..path.."/*.lua" ) ) do
include( path.."/"..v )
end
end
function util.AddCSLuaFiles( path )
if ( CLIENT ) then return end
for k, v in pairs( file.Find( "../"..GM.Folder.."/gamemode/"..path.."/*.lua" ) ) do
AddCSLuaFile( path.."/"..v )
end
end
Now, this works on the server in multiplayer but the client fails to include the files. The files are being sent as including them separately like so works:
include( "jobs/superman.lua" ) // etc
So my question is, why does my function, util.IncludeFolder, not work on the client? I assume it’s something up with the file.Find part, but I see no reason why it should do that.