summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script-beta/vm/eachDef.lua2
-rw-r--r--script-beta/vm/eachField.lua17
2 files changed, 18 insertions, 1 deletions
diff --git a/script-beta/vm/eachDef.lua b/script-beta/vm/eachDef.lua
index 96001d97..19b0c0ed 100644
--- a/script-beta/vm/eachDef.lua
+++ b/script-beta/vm/eachDef.lua
@@ -80,7 +80,7 @@ local function ofField(source, callback)
callback(src)
end
end)
- vm.eachRef(node, function (src)
+ vm.eachDef(node, function (src)
vm.eachFieldInTable(src.value, callback)
end)
end
diff --git a/script-beta/vm/eachField.lua b/script-beta/vm/eachField.lua
index f6a7a57d..4a9e3eef 100644
--- a/script-beta/vm/eachField.lua
+++ b/script-beta/vm/eachField.lua
@@ -32,8 +32,25 @@ local function ofENV(source, callback)
local ref = refs[i]
if ref.type == 'getglobal' then
callback(ref)
+ if guide.getName(ref) == '_G' then
+ local nextSrc = checkNext(ref)
+ if nextSrc then
+ callback(nextSrc)
+ end
+ end
elseif ref.type == 'setglobal' then
callback(ref)
+ if guide.getName(ref) == '_G' then
+ local nextSrc = checkNext(ref)
+ if nextSrc then
+ callback(nextSrc)
+ end
+ end
+ elseif ref.type == 'getlocal' then
+ local nextSrc = checkNext(ref)
+ if nextSrc then
+ callback(nextSrc)
+ end
end
vm.eachFieldInTable(ref.value, callback)
end