[0.16.51] Cannot load game save with sufficiently complex 'global' saved by mod
Posted: Thu Nov 08, 2018 10:15 pm
When saving the game, Factorio serializes the 'global' table into script.dat in the savefile, in plain parseable Lua script. If a mod writes a sufficiently complex table structure into its globals variable, the save fails to serialize that table into Lua code that can be loaded by the Lua parser.
In hopes of getting this fixed, I have created a proof-of-concept serializer that solves this issue by serializing objects in two passes, much like current solution, but makes sure the dependencies are never deeper than they must be: https://gist.github.com/mentlerd/114340 ... 5de6594de6
How to reproduce:
Error when loading the save:
While this issue is unlikely to affect many people, one of the mods I am contributing to is playing with the idea to use the 'global' table for expensive to compute indexes, which usually involve long chains of tables containing each other.
In hopes of getting this fixed, I have created a proof-of-concept serializer that solves this issue by serializing objects in two passes, much like current solution, but makes sure the dependencies are never deeper than they must be: https://gist.github.com/mentlerd/114340 ... 5de6594de6
How to reproduce:
Code: Select all
commands.add_command("ruin_my_save", "none", function(ctx)
local tbl = {}
for i = 1, 256 do
tbl = {tbl}
end
global.HUGE = tbl
end)
Code: Select all
Error while running deserialisation for mod: too many C levels (limit is 200)