Place this file into the startup file: Leave off the extension, as it's more portable across legacy mod versions.
Place files you want to run into /startup.d You may place folders there as well, but they must have an init.lua inside of them.
| -- Startup.d: Portable startup directories | |
| local function startup(startup_dir) | |
| local startup_dir = startup_dir or "/startup.d" -- use the specified folder if it provided, otherwise use default | |
| for _, v in pairs(fs.list(startup_dir)) do | |
| local file = fs.combine(startup_dir .. "/", v) | |
| if fs.isDir(file) then -- Support directories with init.lua | |
| dofile(fs.combine(file, "init.lua")) | |
| else | |
| loadfile(file) | |
| end | |
| end | |
| end | |
| startup() |