Why not use "if mods" in "control. Lua"?

Place to get help with not working mods / modding interface.
sdgmlj
Fast Inserter
Fast Inserter
Posts: 174
Joined: Sun Jul 04, 2021 11:12 pm
Contact:

Why not use "if mods" in "control. Lua"?

Post 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"?
Pi-C
Smart Inserter
Smart Inserter
Posts: 1759
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Why not use "if mods" in "control. Lua"?

Post 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.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
sdgmlj
Fast Inserter
Fast Inserter
Posts: 174
Joined: Sun Jul 04, 2021 11:12 pm
Contact:

Re: Why not use "if mods" in "control. Lua"?

Post 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.
Post Reply

Return to “Modding help”