if mod in the control stage?

Place to get help with not working mods / modding interface.
Post Reply
heloo22
Burner Inserter
Burner Inserter
Posts: 18
Joined: Wed Aug 22, 2018 11:20 am
Contact:

if mod in the control stage?

Post by heloo22 »

possible to check if mod exist inside control.lua :?:
cause this doesnt do it:
if mods[" "] then

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3700
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: if mod in the control stage?

Post by DaveMcW »

Code: Select all

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

Pi-C
Smart Inserter
Smart Inserter
Posts: 1656
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: if mod in the control stage?

Post 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).
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

heloo22
Burner Inserter
Burner Inserter
Posts: 18
Joined: Wed Aug 22, 2018 11:20 am
Contact:

Re: if mod in the control stage?

Post 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

heloo22
Burner Inserter
Burner Inserter
Posts: 18
Joined: Wed Aug 22, 2018 11:20 am
Contact:

Re: if mod in the control stage?

Post 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

Post Reply

Return to “Modding help”