Page 1 of 1
Load tons of files
Posted: Thu Nov 07, 2019 6:59 pm
by Linver
Hi guy,
In data (any phase) of a mod, I have a case like one folder(let's call it A) with many lua file of inizialization of prototypes (is divided for make order), and I want load all files without have to write "require() require() require() require()..." exist a sort of require(A/*)?
Re: Load tons of files
Posted: Thu Nov 07, 2019 7:09 pm
by Honktown
Linver wrote: Thu Nov 07, 2019 6:59 pm
Hi guy,
In data (any phase) of a mod, I have a case like one folder(let's call it A) with many lua file of inizialization of prototypes (is divided for make order), and I want load all files without have to write "require() require() require() require()..." exist a sort of require(A/*)?
You can have a dependencies.lua file, and if certain settings are true or not (don't need to be in-game settings) then a whole bunch of requires are pulled in.
Re: Load tons of files
Posted: Thu Nov 07, 2019 8:44 pm
by eradicator
Linver wrote: Thu Nov 07, 2019 6:59 pm
exist a sort of require(A/*)?
No, the best you can do is using a table that represents the directory structure (possible script-generated). Then build the paths on-the-fly. That way you "only" have to list the filename and directory names once each.