From 2929f89bc1fa96a7b48ee1f736cd50c9d6fc5ab4 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, 8 Oct 2019 15:45:14 +0800 Subject: =?UTF-8?q?=E6=94=AF=E6=8C=81table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server-beta/src/core/engineer.lua | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'server-beta/src/core/engineer.lua') diff --git a/server-beta/src/core/engineer.lua b/server-beta/src/core/engineer.lua index 0f0bff95..5fc92e7e 100644 --- a/server-beta/src/core/engineer.lua +++ b/server-beta/src/core/engineer.lua @@ -59,9 +59,14 @@ mt['local'] = function (self, source, mode, callback) or tp == 'getindex' then callback(parent) end + elseif ref.type == 'setlocal' then + self:eachRef(ref.value, 'field', callback) end end end + if source.value then + self:eachRef(source.value, 'field', callback) + end end end mt['getlocal'] = function (self, source, mode, callback) @@ -142,8 +147,13 @@ mt['field'] = function (self, source, mode, callback) self:eachRef(node, 'field', function (src) if key == guide.getKeyName(src) then if mode == 'def' then - if src.type == 'setfield' then + if src.type == 'setfield' + or src.type == 'tablefield' + then callback(src.field, 'set') + elseif src.type == 'setindex' + or src.type == 'tableindex' then + callback(src.index, 'set') end end end @@ -189,6 +199,17 @@ mt['boolean'] = mt['asindex'] mt['string'] = function (self, source, mode, callback) mt['asindex'](self, source, mode, callback) end +mt['table'] = function (self, source, mode, callback) + if mode == 'field' then + for i = 1, #source do + local src = source[i] + if src.type == 'tablefield' + or src.type == 'tableindex' then + callback(src) + end + end + end +end function mt:getSpecial(source) local node = source.node -- cgit v1.2.3