Factory created object not getting deleted

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.


--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


function on_message(self, message_id, message, sender)

	if message_id == REMOVE then
		print("DELETE col "..self.x.." row "..self.y)


Any and all help deeply appreciated. Thanks.

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?

Thanks for looking at my issue. I have gone through the code over and over again. I am sure that two objects are not occupying the same slot. :cry:

Guess nothing left to do but do the code from the ground up again.

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?


Share the project here and someone might be willing to take a look. Zip your project. Exclude the build and .internal folders.

1 Like