summaryrefslogtreecommitdiff
path: root/script-beta/vm
diff options
context:
space:
mode:
Diffstat (limited to 'script-beta/vm')
-rw-r--r--script-beta/vm/eachField.lua16
-rw-r--r--script-beta/vm/eachRef.lua3
2 files changed, 15 insertions, 4 deletions
diff --git a/script-beta/vm/eachField.lua b/script-beta/vm/eachField.lua
index 16f13d64..d6ef315b 100644
--- a/script-beta/vm/eachField.lua
+++ b/script-beta/vm/eachField.lua
@@ -1,7 +1,8 @@
-local guide = require 'parser.guide'
-local vm = require 'vm.vm'
-local files = require 'files'
-local await = require 'await'
+local guide = require 'parser.guide'
+local vm = require 'vm.vm'
+local files = require 'files'
+local await = require 'await'
+local library = require 'library'
local function ofTabel(value, callback)
if value.library then
@@ -131,6 +132,13 @@ local function eachField(source, callback)
ofENV(ref, callback)
end
end
+ for name, lib in pairs(library.global) do
+ callback {
+ source = lib,
+ key = 's|' .. name,
+ mode = 'value',
+ }
+ end
elseif src.type == 'getlocal'
or src.type == 'getglobal'
or src.type == 'getfield'
diff --git a/script-beta/vm/eachRef.lua b/script-beta/vm/eachRef.lua
index 8a8e4818..b22156b0 100644
--- a/script-beta/vm/eachRef.lua
+++ b/script-beta/vm/eachRef.lua
@@ -177,6 +177,9 @@ local function ofValue(value, callback)
vm.eachRef(value, callback)
local parent = value.parent
+ if not parent then
+ return
+ end
if parent.type == 'local'
or parent.type == 'setglobal'
or parent.type == 'setlocal'