diff options
Diffstat (limited to 'script/vm')
-rw-r--r-- | script/vm/getDocs.lua | 16 | ||||
-rw-r--r-- | script/vm/guideInterface.lua | 16 |
2 files changed, 32 insertions, 0 deletions
diff --git a/script/vm/getDocs.lua b/script/vm/getDocs.lua index 0f4b537d..62e12d18 100644 --- a/script/vm/getDocs.lua +++ b/script/vm/getDocs.lua @@ -84,6 +84,22 @@ function vm.getDocTypes(name) return cache end +function vm.getDocClass(name) + local cache = vm.getCache('getDocClass')[name] + if cache ~= nil then + return cache + end + cache = {} + local results = getDocTypes(name) + for _, doc in ipairs(results) do + if doc.type == 'doc.class.name' then + cache[#cache+1] = doc + end + end + vm.getCache('getDocClass')[name] = cache + return cache +end + function vm.isMetaFile(uri) local status = files.getAst(uri) if not status then diff --git a/script/vm/guideInterface.lua b/script/vm/guideInterface.lua index e646def8..eb809c30 100644 --- a/script/vm/guideInterface.lua +++ b/script/vm/guideInterface.lua @@ -82,7 +82,23 @@ function vm.interface.global(name) return vm.getGlobals(name) end +local basicTypes = { + ['any'] = true, + ['nil'] = true, + ['boolean'] = true, + ['number'] = true, + ['integer'] = true, + ['thread'] = true, + ['table'] = true, + ['string'] = true, + ['userdata'] = true, + ['lightuserdata'] = true, + ['function'] = true, +} function vm.interface.docType(name) + if basicTypes[name] then + return vm.getDocClass(name) + end await.delay() return vm.getDocTypes(name) end |