How do I delete all elements inside a Lua table? I don\'t want to do:
t = {} table.insert(t, 1) t = {} -- this assigns a new pointer to t
I w
easiest and most performant:
for k,v in pairs(tab) do tab[k]=nil end
What you suggest isn't usable: table.remove shifts the remaining elements to close the hole, and thus messes up the table traversal. See the description for the next function for more info
table.remove