I want to be able to delete table data from memory in my script to avoid memory leak, but I’m not sure exactly how. If I were to do tableVar = {} then would that clear the memory or would the data still be floating around somehwere?
im not sure if this is right correct me if i am wrong but i would simply use table.clear()
take a look here table operators
1 Like
If you want to dispose of a table, you have to remove all references to it. However, mostly table.clear
is enough.
1 Like
You can use table.clear()
, however removing parts of a table, you can use table.remove()
.
As everyone has already said table.clear(t) would be the best method of removing a table’s contents, just leave it to the GC to pick it up and remove it from memory (if no references are still in scope)