diff options
Diffstat (limited to 'server-beta/src/core/number.lua')
-rw-r--r-- | server-beta/src/core/number.lua | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/server-beta/src/core/number.lua b/server-beta/src/core/number.lua index c27f6579..15aef9e5 100644 --- a/server-beta/src/core/number.lua +++ b/server-beta/src/core/number.lua @@ -1,11 +1,39 @@ +local guide = require 'parser.guide' + local m = {} function m:def(source, callback) - self:asIndex(source, 'def', callback) + local parent = source.parent + if not parent then + return + end + if parent.type ~= 'setindex' and parent.type ~= 'getindex' then + return + end + local node = parent.node + local key = guide.getKeyName(source) + self:eachField(node, key, function (src, mode) + if mode == 'set' then + callback(src, mode) + end + end) end function m:ref(source, callback) - self:asIndex(source, 'ref', callback) + local parent = source.parent + if not parent then + return + end + if parent.type ~= 'setindex' and parent.type ~= 'getindex' then + return + end + local node = parent.node + local key = guide.getKeyName(source) + self:eachField(node, key, function (src, mode) + if mode == 'set' or mode == 'get' then + callback(src, mode) + end + end) end return m |