diff options
-rw-r--r-- | server/src/vm/function.lua | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/server/src/vm/function.lua b/server/src/vm/function.lua index 24990448..17cc237b 100644 --- a/server/src/vm/function.lua +++ b/server/src/vm/function.lua @@ -132,10 +132,18 @@ function mt:run() end -- 第一次运行函数时,创建函数的参数 - if self._runed == 1 then - self:createArgs() + if self._runed ~= 1 then + return + end + + -- 如果是面向对象形式的函数,创建隐藏的参数self + if self._object then + self:saveLocal('self', self._object) end + -- 显性声明的参数 + self:createArgs() + --local index = 0 --if func.object then -- local var = self:createArg('self', func.colon, self:getValue--(func.object, func.colon)) |