fd = io.popen("ls /path/to/mods")
File = fd:read()
while File ~= nil do
Mod = File:match("([^%/%.]+).lua$")
if Mod ~= nil then require(Mod) end
File = fd:read()
end
This one's a bit safer, and 'find' has all kinds of options to restrict your search:
local fd <close> = io.popen("find . -maxdepth 1 -type f -name '*.lua' -print0")
local data = "">fd:close()
for f in string.gmatch(data, "[^\0]+") do
print(f)
end
--