Running, without the mod present, a scenario saved with the mod present, aborts in the on_configuration_changed hook, with the title error.
Code: Select all
function configuration_changed(...)
if (remote.interfaces.BenchmarkProduction or empty).insta
then
on('marked_for_deconstruction')
on('built_entity')
for n = 1,#game.players do
remote.call('BenchmarkProduction','insta',{player_index=n})
end
else
on('marked_for_deconstruction',instakill)
on('built_entity',instabuild)
end
end
on('configuration_changed',configuration_changed)
Code: Select all
------------- Error -------------
Error while running on_configuration_changed: /home/quyxkh/.factorio/temp/currently-playing/control.lua:26: attempt to index upvalue '_ENV' (a nil value)
---------------------------------
Code: Select all
local bootstraps={init=1,load=1,configuration_changed=1}
function on (s,f)
local on_s ='on_'..s
local e = defines.events[on_s]
if e then
notrace[e]=true
return script.on_event(e,f)
elseif bootstraps[s] then
return script[on_s](f)
else -- a custom input
return script.on_event(s,f)
end
end
The api docs say
Will someone please point out what I'm missing here? If I can't check in on_load and can't check in on_configuration_changed, when can I check? Or alternately, if o-c-c is the right place, how should I be doing it?. control.lua script.on_configuration_changed()
When mods are changed (prototypes added or removed), the major game version changes, a mod version changes, a mod is removed, or a mod is added the script.on_configuration_changed() event is fired for each mod subscribed to that event.
This is the main place for handling mod internal data structure changes. Access to the global table, game table and game state are available and can be changed in any way seen fit by the mod.