From 1d8d37ce97e3ea7097dd23a4ac90198c92ed611b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Tue, 10 Dec 2019 21:26:35 +0800 Subject: =?UTF-8?q?=E6=94=AF=E6=8C=81=E8=B0=83=E7=94=A8=E7=89=87=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script-beta/vm/eachDef.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'script-beta/vm') diff --git a/script-beta/vm/eachDef.lua b/script-beta/vm/eachDef.lua index 1b7ea621..54460942 100644 --- a/script-beta/vm/eachDef.lua +++ b/script-beta/vm/eachDef.lua @@ -36,12 +36,13 @@ function vm.eachDef(source, callback) end end) + local res for _, info in ipairs(results) do local src = info.source local destUri = guide.getRoot(src).uri -- 如果是library,则直接放行 if src.library then - callback(info) + res = callback(info) goto CONTINUE end -- 如果是global或field,则直接放行(因为无法确定顺序) @@ -51,21 +52,24 @@ function vm.eachDef(source, callback) or src.type == 'tablefield' or src.type == 'tableindex' or src.type == 'setglobal' then - callback(info) + res = callback(info) goto CONTINUE end -- 如果是同一个文件,则检查位置关系后放行 if sourceUri == destUri then if checkPath(source, info) then - callback(info) + res = callback(info) end goto CONTINUE end -- 如果不是同一个文件,则必须在该文件 return 后才放行 if valueUris[destUri] then - callback(info) + res = callback(info) goto CONTINUE end ::CONTINUE:: + if res ~= nil then + return res + end end end -- cgit v1.2.3