Page 1 of 1
What's allowed/disallowed during migration?
Posted: Thu May 04, 2017 9:10 am
by apriori
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?
Posted: Thu May 04, 2017 1:05 pm
by Nexela
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
Re: What's allowed/disallowed during migration?
Posted: Sun May 07, 2017 9:11 pm
by apriori
Nexela wrote:on_configuration_change -> access to everything
Looks like not to everything, or I'm wrong in my code:
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?
Posted: Sun May 07, 2017 9:49 pm
by Nexela
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