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/*)?
Load tons of files
Re: Load tons of files
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.Linver wrote: ↑Thu Nov 07, 2019 6:59 pmHi 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/*)?
I have mods! I guess!
Link
Link
- eradicator
- Smart Inserter
- Posts: 5206
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Load tons of files
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.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.