Hi,
I have a bunch of factory created objects . When I try to delete, a few are not getting deleted even though I can see that the object is getting the message to be deleted.
Util.lua
--block is object at position x and y on table called slots
if block.type == block_type.PLAIN then
print("REMOVED PLAIN at x "..x.." y "..y)
msg.post(block.id, M.REMOVE)
slots[block.x][block.y] = nil
end
block.script
function on_message(self, message_id, message, sender)
if message_id == REMOVE then
print("DELETE col "..self.x.." row "..self.y)
go.delete()
end
end
There is nothing that stands out as obviously wrong with the code. Are you absolutely sure that there’s not more than one object on the same X and Y position/slot in until.lua?
Rewriting the code again probably isn’t going to help solve a problem that will likely show its face again without an understanding of what’s going on. What do you mean by “a few” aren’t getting deleted? Can you be more specific? Maybe show us the full block and slots structures?