Hello! I’m new to making games with Defold. In Unity or Godot you can have objects referencing each other. But In Defold I can’t do the same with Lua tables due to serialization issues.
Looping references give an error. And if multiple tables refence another table, the referenced table gets duplicated:
One way to solve this is to add an ID to every object. But I’m not sure this is a good solution:
rooms.get_creatures_inside = function(room_id)
local creatures = {}
local room = rooms.get_by_id(room_id)
for k, creature in ipairs(room.creatures_inside) do
table.insert(creatures, creature)
end
return creatures
end
