Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Pairs and memory — Gideros Forum

Pairs and memory

beunnbeunn Member
edited August 2013 in General questions
Hello,

I've got a problem with memory and pairs. I want to erase an object from this pairs with self.pair[index] = nil but the object is not erase from the pairs. All the parameters of the object are nil but not the object from the pairs. Why? And how can i delete it ? I tried to call the garbage collector but doesn't work.

Thanks,
Beunn

Comments

  • @beunn as I understand you basically want to remove object from the table so that table reindexed itself, so there won't be any objects in the middle with nil.

    if yes, you can try using table object for inserting and removing objects from table
    table.insert(table, value) or table.insert(table, index, value) and
    table.remove(table, index)
    self.pair = {}
    table.insert(self.pair, "some value")
    table.remove(self.pair, 1)
    More info:
    http://lua-users.org/wiki/TablesTutorial

    ;)
Sign In or Register to comment.