summaryrefslogtreecommitdiff
path: root/server/src/vm
diff options
context:
space:
mode:
authorsumneko <sumneko@hotmail.com>2019-04-09 11:46:48 +0800
committersumneko <sumneko@hotmail.com>2019-04-09 11:46:48 +0800
commit035d88af85a343c234d50a646835d55e1277d602 (patch)
treedbd9484648c1c1d0ac92689ccfc4dff8644fa4a5 /server/src/vm
parent2dd91ba29a26b2b4fc7f07def2b3edbb962248d9 (diff)
downloadlua-language-server-035d88af85a343c234d50a646835d55e1277d602.zip
库函数以函数为参数时,立即跑一边传入的函数
Diffstat (limited to 'server/src/vm')
-rw-r--r--server/src/vm/vm.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/server/src/vm/vm.lua b/server/src/vm/vm.lua
index 2a223d42..dfdac390 100644
--- a/server/src/vm/vm.lua
+++ b/server/src/vm/vm.lua
@@ -278,6 +278,20 @@ function mt:callLibrary(func, values, source, lib)
elseif lib.special == 'seeall' then
self:callSeeAll(func, values)
end
+ else
+ -- 如果lib的参数中有function,则立即执行function
+ if lib.args then
+ local args
+ for i = 1, #lib.args do
+ local value = values[i]
+ if value and value:getFunction() then
+ if not args then
+ args = createMulti()
+ end
+ self:call(value, args, source)
+ end
+ end
+ end
end
end