diff options
Diffstat (limited to 'script/vm/global.lua')
-rw-r--r-- | script/vm/global.lua | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/script/vm/global.lua b/script/vm/global.lua index 590264bd..29474b57 100644 --- a/script/vm/global.lua +++ b/script/vm/global.lua @@ -42,7 +42,7 @@ function mt:addGet(uri, source) self.getsCache = nil end ----@param suri uri +---@param suri uri ---@return parser.object[] function mt:getSets(suri) if not self.setsCache then @@ -73,6 +73,27 @@ function mt:getSets(suri) end ---@return parser.object[] +function mt:getAllSets() + if not self.setsCache then + self.setsCache = {} + end + local cache = self.setsCache['*'] + if cache then + return cache + end + cache = {} + self.setsCache['*'] = cache + for _, link in pairs(self.links) do + if link.sets then + for _, source in ipairs(link.sets) do + cache[#cache+1] = source + end + end + end + return cache +end + +---@return parser.object[] function mt:getGets(suri) if not self.getsCache then self.getsCache = {} @@ -467,6 +488,11 @@ function vm.getGlobals(cate) return globals end +---@return table<string, vm.global> +function vm.getAllGlobals() + return allGlobals +end + ---@param suri uri ---@param cate vm.global.cate ---@return parser.object[] |