summaryrefslogtreecommitdiff
path: root/script-beta/vm/getClass.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-01-23 14:34:36 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-01-23 14:34:36 +0800
commit6b4ac4345b65bdf0a26f5f59feaa8353df3a10b1 (patch)
tree9889b1be2c917a42ceb50ed256efc14284de9f7a /script-beta/vm/getClass.lua
parent09172c28a3bd08232def3de16b8afdb5909ba3be (diff)
downloadlua-language-server-6b4ac4345b65bdf0a26f5f59feaa8353df3a10b1.zip
table中的class
Diffstat (limited to 'script-beta/vm/getClass.lua')
-rw-r--r--script-beta/vm/getClass.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/script-beta/vm/getClass.lua b/script-beta/vm/getClass.lua
index 295ffae3..c4bde74a 100644
--- a/script-beta/vm/getClass.lua
+++ b/script-beta/vm/getClass.lua
@@ -16,12 +16,31 @@ local function getClass(source, classes, deep)
end
end
end)
+ if source.value then
+ vm.eachField(source.value, function (src)
+ local key = vm.getKeyName(src)
+ local lkey = key:lower()
+ if lkey == 's|type'
+ or lkey == 's|__name'
+ or lkey == 's|name'
+ or lkey == 's|class' then
+ if src.value and src.value.type == 'string' then
+ classes[#classes+1] = src.value[1]
+ end
+ end
+ end)
+ end
if #classes ~= 0 then
return
end
vm.eachMeta(source, function (mt)
getClass(mt, classes, deep + 1)
end)
+ if source.value then
+ vm.eachMeta(source.value, function (mt)
+ getClass(mt, classes, deep + 1)
+ end)
+ end
end
function vm.getClass(source)