Load all files in the folders of a gamemode

I’m currently working on a gamemode and its going great.

But
The amount of files I intend on having means I need to import them all individually.

I tried to use:



for k, v in pairs(file.Find("desire/gamemode/sv_modules/*.lua","LUA")) do include("sv_modules/" .. v); end


But it seems to give no effect.

Any ideas??

Bump

Here’s how I do it.

[lua]
local sv_files, sv_folders = file.Find(“addons/core/lua/extensions/sv_*.lua”, “GAME”)

for k, v in pairs(sv_files) do
if SERVER then
include(v)
end
end
[/lua]

[lua]local f, d = file.Find(“gamemodes/desire/sv_modules/*.lua”, “GAME”)

for k,v in pairs(f) do
print(v)
end[/lua]

This should print all the lua files. If you want to list all the directories in a path, use d instead of f

Doesn’t seem to work. Although it does find the file?

That is for the base folder of the gamemode.

Make sure the files have data… If they’re empty they will not load. Also make sure Shared and Client files are AddCSLuaFile’d BEFORE the include line.

Here’s how I autoload ( sh_init.lua from the src( https://bitbucket.org/Acecool/acecooldev_base/src/master/gamemode/sh_init.lua?at=master )… Documentation to see which files/folders do what: https://bitbucket.org/Acecool/acecooldev_base/src/master/documentation/acecooldev_base_autoloader_file_and_folder_recognition_details.txt?at=master ):

Acecool Dev Base Skeletonized Base Game-Mode ( Never worry about Include or AddCSLuaFile ever again; comes with New Hooks, Console Commands, Meta-Table Objects, Helper Functions, Extended Functionality, and more! )
https://dl.dropboxusercontent.com/u/26074909/tutoring/___welcome_docs/_welcome_acecooldev_base_gamemode_info.lua.html