Page 1 of 1
Why not use "if mods" in "control. Lua"?
Posted: Mon Feb 28, 2022 10:42 am
by sdgmlj
I will report an error after using it,
But I'm normal in "settings. Lua".
So how to check other modules in "control. Lua"?
Re: Why not use "if mods" in "control. Lua"?
Posted: Mon Feb 28, 2022 11:23 am
by Pi-C
Check out
game.active_mods and
script.active_mods! Both can be used in control.lua (and, of course, files required there) to get the list of active mods. The difference is that script.active_mods can already be used when script.on_load() is running while the global table 'game' (and with it, game.active_mods) is only accessible when script.on_load() has finished.
This text about the
data lifecycle provides some background.
Re: Why not use "if mods" in "control. Lua"?
Posted: Mon Feb 28, 2022 11:20 pm
by sdgmlj
Pi-C wrote: Mon Feb 28, 2022 11:23 am
Check out
game.active_mods and
script.active_mods! Both can be used in control.lua (and, of course, files required there) to get the list of active mods. The difference is that script.active_mods can already be used when script.on_load() is running while the global table 'game' (and with it, game.active_mods) is only accessible when script.on_load() has finished.
This text about the
data lifecycle provides some background.
Thank you.