I have a table in a script, after one use, I do not plan on using it again, so which way is better when it comes to efficiency?
Should I clear the table like this?
for index in pairs(thisTable) do thisTable[index] = nil end
Or should I just set the table to nil like this?
thisTable = nil
Way simpler to just do Table = nil
, I’m assuming that Table = nil
uses less memory than a loop but its a minute difference. Whatever floats your boat.
2 Likes
It’s simpler to just do table.clear(thisTable)
in my opinion. Keep the table and it clears it without a loop.