Closed wrefgtzweve closed 1 year ago
Sure, it seems like a useful addition.
The environment is created from scratch for each invocation to gluasteal.lua. You would have to store the variable in _G.
if _G.firstRun then return end
_G.firstRun = true
I prefer to check if the file being executed is includes/init.lua
which is the first file to execute in the Lua state.
if gluasteal.SCRIPT ~= "includes/init.lua" then return end
-- Code that runs once, before includes/init.lua
On second thought, I'm not sure it's worthwhile implementing this when all you need is:
if gluasteal.SCRIPT == "includes/init.lua" then
gluasteal.include("pre-autorun.lua")
end
Yeah that'd pretty much run before any lua, might not be worth the time to make that a build in feature.
A file that runs once before any server lua might be very useful, currently it'd be possible with lua but having an option to just automatically do it would be useful. Something like
pre-autorun.lua
or so. I ran into this issue when i was trying to test some pre autorun code but it seemed like it still constantly ran.Simply running this at the top of the file didn't seem to work as maybe the environment constantly changes per file? I'm not exactly sure but it'd just be neat to have a file to run only once.