TL;DR
When loading a save which had a mod enabled, which is now disabled, it will still be in script.active_mods during mod initialization.Expected
script.active_mods should always only have mods in it which are currently active.Example
ScriptActiveModsIssue/control.lua:Code: Select all
if script.active_mods["ScriptActiveModsIssueDummy"] then
require("__ScriptActiveModsIssueDummy__/empty.lua") -- this is line 3
end
Reproduce
- Only have the mod ScriptActiveModsIssue enabled
- Load the provided save
- Have both provided mods enabled
- Create a new world
- Save it
- Disable the mod ScriptActiveModsIssueDummy
- Load the previously saved game
Workaround
keep using pcall require, which script.active_mods was supposed to replaceCode: Select all
pcall(require, "__ScriptActiveModsIssueDummy__/empty.lua")