table.wipe also reset array size if needed

This commit is contained in:
Pinya
2017-12-17 22:18:29 +03:00
parent 183adcc6ea
commit 29dff94917
+5 -1
View File
@@ -8,8 +8,8 @@ local tostring = tostring
local type = type
local unpack = unpack
local ceil, floor = math.ceil, math.floor
local getn, tinsert = table.getn, table.insert
local find, format, gfind, gsub, sub = string.find, string.format, string.gfind, string.gsub, string.sub
local getn, setn, tinsert = table.getn, table.setn, table.insert
math.huge = 1/0
string.gmatch = gfind
@@ -133,6 +133,10 @@ function table.wipe(t)
t[k] = nil
end
if getn(t) ~= 0 then
setn(t, 0)
end
return t
end
wipe = table.wipe