From 55dc0cc8a8d6fe6893aac8ab0a150a1fd6001aba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Tue, 12 Mar 2019 17:41:00 +0800 Subject: =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/vm/value.lua | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'server/src/vm/value.lua') diff --git a/server/src/vm/value.lua b/server/src/vm/value.lua index f41d30e0..3cbccdd0 100644 --- a/server/src/vm/value.lua +++ b/server/src/vm/value.lua @@ -23,6 +23,7 @@ local function create (tp, source, literal) _type = {}, _literal = literal, _info = {}, + _infoCheck = 10, }, mt) if type(tp) == 'table' then for i = 1, #tp do @@ -246,7 +247,7 @@ function mt:addInfo(tp, source, ...) if self._info[source] then return end - if not source then + if not source or not source.isRemoved then return end local info = { @@ -256,6 +257,22 @@ function mt:addInfo(tp, source, ...) } self._info[#self._info+1] = info self._info[info.source] = true + + -- 清除无效的info + --if #self._info > self._infoCheck then + -- for i = #self._info, 1, -1 do + -- local info = self._info[i] + -- local src = info.source + -- if src:isRemoved() then + -- table.remove(self._info, i) + -- self._info[src] = nil + -- end + -- end + -- self._infoCheck = #self._info * 2 + -- if self._infoCheck < 10 then + -- self._infoCheck = 10 + -- end + --end end function mt:eachInfo(callback) -- cgit v1.2.3