Page 1 of 1

Reading installed mods in control.lua

Posted: Wed Jan 06, 2021 12:48 am
by N0TZ3R0
Hello ppl, I hope y'all are great, so, I'm new to modding, and I searched a little bit ( 3 days maybe ) and I can't find a proper ( and simple ) way to check if a mod exist inside control.lua, could u guys please give me an example?

Posted: Wed Jan 06, 2021 1:34 am
by Deadlock989
https://lua-api.factorio.com/latest/Lua ... ctive_mods

Code: Select all

if game.active_mods["SomeModName"] then
	...
end

Re: Reading installed mods in control.lua

Posted: Tue Jan 19, 2021 6:40 pm
by eradicator
Note: LuaGameScript is only accessible inside of event handlers.

Re: Reading installed mods in control.lua

Posted: Tue Jan 19, 2021 6:47 pm
by Pi-C
eradicator wrote: Tue Jan 19, 2021 6:40 pm Note: LuaGameScript is only accessible inside of event handlers.
But there is LuaBootstrap which should work even if LuaGameScript isn't available. So just replace "game.active_mods" with "script.active_mods" …