I was using table.insert() to add in players but I want it to clear using table.remove(), but I think table.remove only removes one chosen variable, I want it to remove all. Any help please?
✓ ANSWER ACCEPTED
How do you remove all variables in a Table?
1 answer
✓ Accepted answer
Well, there are many ways of doing it, but here are two.
Way 1: The pointlessly excessive way
function clearTable(tab)
for i,v in pairs(tab) do
table.remove(tab,i)
end
end
Way 2: The nice and elegant way
Table = {}
Way 2 just overrides the old table with a new fresh blank one.
1 comment
0
Thanks
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
local table = {stuff = "1"} table = {}