From 170d7a2894ca9cb758edc9f75343889552d07e0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 30 Jan 2019 17:57:51 +0800 Subject: =?UTF-8?q?=E7=94=A8=E8=A1=A8=E6=9D=A5=E8=BF=87=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/core/value.lua | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'server/src/core') diff --git a/server/src/core/value.lua b/server/src/core/value.lua index ad3a48e8..2c364b62 100644 --- a/server/src/core/value.lua +++ b/server/src/core/value.lua @@ -126,21 +126,21 @@ function mt:setChild(child) self._child = child end -function mt:getField(name, source, stack) +function mt:getField(name, source, mark) local field = self:rawGetField(name, source) if not field then local indexMeta = self:getMeta('__index', source) if not indexMeta then return nil end - if not stack then - stack = 0 + if not mark then + mark = {} end - stack = stack + 1 - if stack > 10 then + if mark[indexMeta] then return nil end - return indexMeta.value:getField(name, source, stack) + mark[indexMeta] = true + return indexMeta.value:getField(name, source, mark) end return field end @@ -158,7 +158,7 @@ function mt:rawEachField(callback) return nil end -function mt:eachField(callback, stack) +function mt:eachField(callback, stack, mark) local res = self:rawEachField(callback) if res ~= nil then return res @@ -167,14 +167,14 @@ function mt:eachField(callback, stack) if not indexMeta then return nil end - if not stack then - stack = 0 + if not mark then + mark = {} end - stack = stack + 1 - if stack > 10 then + if mark[indexMeta] then return nil end - return indexMeta.value:eachField(callback, stack) + mark[indexMeta] = true + return indexMeta.value:eachField(callback, stack, mark) end function mt:removeUri(uri) -- cgit v1.2.3