[0.16.51] Running LuaObjects through inspect's "process" will crash factorio to desktop
Posted: Sat Dec 22, 2018 2:43 am
The following code block in control.lua will run happily. However it will leave Factorio in a state where if you process the wrong bit of data, if you try to restart, or if you just try to quit to the main menu the game will crash to desktop (usually without a log):
Since inspect is bundled with Factorio I (incorrectly) assumed it wasn't going to be an issue to use it and all the options therein. In hindsight it makes total sense that you can't run a metatable or metatable elements or whatever through a function the way I did. Getting to that conclusion cost me about 6 hours time though because I wasn't sure where the issue was coming from.
It would be greatly appreciated if this restriction were documented in some way, even if it's just a 1-line throwaway comment at the top of inspect.lua itself.
Thanks.
Code: Select all
local inspect = require 'inspect'
local filter = function(item)
return item
end
local function player_joined()
global.make_inspect_crash_factorio = game.players[1]
local dump_string = inspect(global, {process = filter})
if dump_string then
game.write_file('dump.lua', dump_string)
game.print('dumped')
end
end
script.on_event(defines.events.on_player_joined_game, player_joined)
It would be greatly appreciated if this restriction were documented in some way, even if it's just a 1-line throwaway comment at the top of inspect.lua itself.
Thanks.