[0.15.37] Crash related to copying game objects
Posted: Tue Oct 31, 2017 4:52 pm
I accidentally tried to copy a table that has a player as a member (using a custom copy function). The game outputs an error into chat which is fine, then crashes which probably isnt. To reproduce in single-player 0.15.37:
Code: Select all
/c
function copy(obj, seen)
if type(obj) ~= 'table' then return obj end
if seen and seen[obj] then return seen[obj] end
local s = seen or {}
local res = setmetatable({}, getmetatable(obj))
s[obj] = res
for k, v in pairs(obj) do res[copy(k, s)] = copy(v, s) end
return res
end
copy(game.player)