Page 1 of 1

if mod in the control stage?

Posted: Fri Feb 05, 2021 2:46 pm
by heloo22
possible to check if mod exist inside control.lua :?:
cause this doesnt do it:
if mods[" "] then

Re: if mod in the control stage?

Posted: Fri Feb 05, 2021 2:51 pm
by DaveMcW

Code: Select all

if game.active_mods["mod-name"] then

Re: if mod in the control stage?

Posted: Fri Feb 05, 2021 3:02 pm
by Pi-C
DaveMcW wrote: Fri Feb 05, 2021 2:51 pm

Code: Select all

if game.active_mods["mod-name"] then
game.active_mods will be available only when loading the game has completed, but you may want to access the mod list before that (i.e. while on_load is active). Querying script.active_mods is more versatile (it's available right after control.lua has been entered).

Re: if mod in the control stage?

Posted: Fri Feb 05, 2021 3:11 pm
by heloo22
DaveMcW wrote: Fri Feb 05, 2021 2:51 pm

Code: Select all

if game.active_mods["mod-name"] then
when loading a map this pops up:
attempt to index global 'game' a nil value

Re: if mod in the control stage?

Posted: Fri Feb 05, 2021 3:14 pm
by heloo22
Pi-C wrote: Fri Feb 05, 2021 3:02 pm
DaveMcW wrote: Fri Feb 05, 2021 2:51 pm

Code: Select all

if game.active_mods["mod-name"] then
game.active_mods will be available only when loading the game has completed, but you may want to access the mod list before that (i.e. while on_load is active). Querying script.active_mods is more versatile (it's available right after control.lua has been entered).
yes this one seems to do the trick

if script.active_mods[" "] then

thank you guys :D