Removing entry from table

Posted by Bnhjhvbq7 on Stack Overflow See other posts from Stack Overflow or by Bnhjhvbq7
Published on 2013-06-29T22:19:30Z Indexed on 2013/06/29 22:21 UTC
Read the original article Hit count: 258

Filed under:
|
|
|
|

Can't remove an entry from table.

here's my code

            dropItem = dropList[ math.random( #dropList ) ]
            dropSomething[brick.index] = crackSheet:grabSprite(dropItem, true)
            dropSomething[brick.index].x = brick.x
            dropSomething[brick.index].y = brick.y
            dropSomething[brick.index].name = dropItem
            dropSomething[brick.index].type = "dropppedItems"

collision

function bounce(event)
        local item = event.other
        if item.type == "dropppedItems" then
            if item.name == "bomb" then
                Lives = Lives - 1
                LivesNum.text = tostring(Lives)
            end
        item:removeSelf();
        end     

end

What I've tried:

item:removeSelf(); - removes the whole table

item = nil - seams to do nothing, the object continue to move and i still see the image

© Stack Overflow or respective owner

Related posts about arrays

Related posts about table