summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server/src/vm/function.lua12
-rw-r--r--server/src/vm/vm.lua4
2 files changed, 12 insertions, 4 deletions
diff --git a/server/src/vm/function.lua b/server/src/vm/function.lua
index 8d45ef8e..e246509d 100644
--- a/server/src/vm/function.lua
+++ b/server/src/vm/function.lua
@@ -138,16 +138,16 @@ function mt:hasRuned()
return self._runed > 0
end
+function mt:needSkip()
+ return self._runed > 1
+end
+
function mt:run(vm)
self._runed = self._runed + 1
if not self.source then
return
end
- if self._runed > 1 then
- --return
- end
-
-- 第一次运行函数时,创建函数的参数
if self._runed == 1 then
-- 如果是面向对象形式的函数,创建隐藏的参数self
@@ -162,6 +162,10 @@ function mt:run(vm)
self:createArgs(vm)
end
+ if self:needSkip() then
+ return
+ end
+
-- 向局部变量中填充参数
for i, loc in ipairs(self.args) do
loc:setValue(self.argValues[i] or createValue('nil', arg))
diff --git a/server/src/vm/vm.lua b/server/src/vm/vm.lua
index a8834806..9e685138 100644
--- a/server/src/vm/vm.lua
+++ b/server/src/vm/vm.lua
@@ -98,6 +98,10 @@ function mt:runFunction(func)
return
end
+ if func:needSkip() then
+ return
+ end
+
-- 暂时使用这种方式激活参数的source
for _, arg in ipairs(func.args) do
if arg.source ~= func:getObject() then