From 29dff94917c5c8201f86492ffcf86a3dad1c4bdc Mon Sep 17 00:00:00 2001 From: Pinya <800pin.ru@gmail.com> Date: Sun, 17 Dec 2017 22:18:29 +0300 Subject: [PATCH] table.wipe also reset array size if needed --- !Compatibility/api/luaAPI.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/!Compatibility/api/luaAPI.lua b/!Compatibility/api/luaAPI.lua index 5581336..de554ce 100644 --- a/!Compatibility/api/luaAPI.lua +++ b/!Compatibility/api/luaAPI.lua @@ -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