What's allowed/disallowed during migration?
What's allowed/disallowed during migration?
What cannot be accessed through migration lua-scripts? Are "global" and "game" available? Are entities valid? Are entities (including hidden ones) without prototypes still accessible?
Re: What's allowed/disallowed during migration?
migration/migrations.json -> Used to replace 1 prototype with another
migration/migrations.lua -> Full access to game NO access to global
on_configuration_change -> access to everything
on_load -> special case, No game, Read only global
on_init -> full access to everything
migration/migrations.lua -> Full access to game NO access to global
on_configuration_change -> access to everything
on_load -> special case, No game, Read only global
on_init -> full access to everything
Re: What's allowed/disallowed during migration?
Looks like not to everything, or I'm wrong in my code:Nexela wrote:on_configuration_change -> access to everything
Code: Select all
script.on_configuration_changed(Migrate())
function Migrate()
local version = game.active_mods["Teleportation"] -- attempt to index global 'game' (a nil value)
end
Re: What's allowed/disallowed during migration?
2 Problems
script.on_configuration_changed(Migrate) --Remove the () your want to refrence the function not call it
Second, move the migrate function ABOVE the script.on_configuration_changed
script.on_configuration_changed(Migrate) --Remove the () your want to refrence the function not call it
Second, move the migrate function ABOVE the script.on_configuration_changed