Reading installed mods in control.lua

Place to get help with not working mods / modding interface.
Post Reply
N0TZ3R0
Inserter
Inserter
Posts: 22
Joined: Tue Dec 29, 2020 1:36 am
Contact:

Reading installed mods in control.lua

Post 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?

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2384
Joined: Fri Nov 06, 2015 7:41 pm

Post by Deadlock989 »

https://lua-api.factorio.com/latest/Lua ... ctive_mods

Code: Select all

if game.active_mods["SomeModName"] then
	...
end
"If Stalin had a good writeup on programming, would linking that be dangerous?"

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5201
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Reading installed mods in control.lua

Post by eradicator »

Note: LuaGameScript is only accessible inside of event handlers.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

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

Re: Reading installed mods in control.lua

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

Post Reply

Return to “Modding help”