diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-03-04 16:16:49 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-03-04 16:16:49 +0800 |
commit | d165bf61b7f9d004cc670f6d5316096406054d2d (patch) | |
tree | 7f38daeeb8d3eb1f488738acbfaaa4d793bed59e /server/src/vm/value.lua | |
parent | 4dddd5e97906202f772642486c6e55ae89d67f81 (diff) | |
download | lua-language-server-d165bf61b7f9d004cc670f6d5316096406054d2d.zip |
换个方法支持object
Diffstat (limited to 'server/src/vm/value.lua')
-rw-r--r-- | server/src/vm/value.lua | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/server/src/vm/value.lua b/server/src/vm/value.lua index 18b92667..a151adc3 100644 --- a/server/src/vm/value.lua +++ b/server/src/vm/value.lua @@ -1,3 +1,6 @@ +local libraryBuilder = require 'vm.library' +local library = require 'core.library' + local function getDefaultSource() return { start = 0, @@ -77,6 +80,15 @@ function mt:setChild(index, value) return value end +function mt:getLibChild(index) + local tp = self:getType() + local lib = library.object[tp] + if lib then + local childs = libraryBuilder.child(lib) + return childs[index] + end +end + function mt:getChild(index, mark) self:setType('table', 0.5) local value = self:rawGet(index) @@ -85,7 +97,7 @@ function mt:getChild(index, mark) end local method = self:getMetaMethod('__index') if not method then - return nil + return self:getLibChild(index) end if not mark then mark = {} |