summaryrefslogtreecommitdiff
path: root/script-beta/vm/getGlobals.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-09-18 21:54:30 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-09-18 21:54:30 +0800
commit138adf804985b0343f15c1d8c464bdb1c2b6c69d (patch)
tree8334ac853f77cff51eb6a27a3bcfe1956f340bbc /script-beta/vm/getGlobals.lua
parent520b0b8e8b480fce1dd4152a5d8d519653863778 (diff)
downloadlua-language-server-138adf804985b0343f15c1d8c464bdb1c2b6c69d.zip
优化性能
Diffstat (limited to 'script-beta/vm/getGlobals.lua')
-rw-r--r--script-beta/vm/getGlobals.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/script-beta/vm/getGlobals.lua b/script-beta/vm/getGlobals.lua
index 16dce873..c6651048 100644
--- a/script-beta/vm/getGlobals.lua
+++ b/script-beta/vm/getGlobals.lua
@@ -62,3 +62,19 @@ function vm.getGlobals(name)
vm.getCache('getGlobals')[name] = cache
return cache
end
+
+function vm.getGlobalSets(name)
+ local cache = vm.getCache('getGlobalDefs')[name]
+ if cache ~= nil then
+ return cache
+ end
+ cache = {}
+ local refs = getGlobals(name)
+ for _, source in ipairs(refs) do
+ if vm.isSet(source) then
+ cache[#cache+1] = source
+ end
+ end
+ vm.getCache('getGlobals')[name] = cache
+ return cache
+end