Can tables be removed by setting it to nil?

Hello everyone,

i have a table with loads of elements in them. and when i call table.remove , it freezes the game for a second. But when i do this :
example :

mytable = nil
collectgarbage(“collect”)

it doesn’t freeze in above situation. So is the above mentioned way a proper way to empty tables and free memory?. Thank you :slight_smile:
[import]uid: 78994 topic_id: 15961 reply_id: 315961[/import]

Long answer short…

You might want to read up on Tables Part 1 and Part 2

If you rip out the Index in a Book, do all the chapters disappear?
What you have done is just pointed the Index to nothing, the contents are still there in memory.
cheers,

?:slight_smile: [import]uid: 3826 topic_id: 15961 reply_id: 59110[/import]

Hello Jayant,

Thank you so much . that helped. :slight_smile: [import]uid: 78994 topic_id: 15961 reply_id: 59112[/import]

@Jayant nice analogy! :slight_smile: [import]uid: 64174 topic_id: 15961 reply_id: 59292[/import]