summaryrefslogtreecommitdiff
path: root/server/src/vm
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/vm')
-rw-r--r--server/src/vm/function.lua13
1 files changed, 9 insertions, 4 deletions
diff --git a/server/src/vm/function.lua b/server/src/vm/function.lua
index 8eebb59c..976f8ab2 100644
--- a/server/src/vm/function.lua
+++ b/server/src/vm/function.lua
@@ -158,7 +158,9 @@ function mt:run()
end
function mt:setArgs(values)
- self.argValues = {}
+ for i = 1, #self.argValues do
+ self.argValues[i] = nil
+ end
for i = 1, #values do
self.argValues[i] = values[i]
end
@@ -171,7 +173,7 @@ function mt:createArg(arg, values)
self:saveLocal(arg[1], loc)
self.args[#self.args+1] = loc
elseif arg.type == '...' then
- self._dots = createMulti(values)
+ self._dots = createMulti()
for i = 1, #values do
self._dots:set(i, values[i])
end
@@ -201,8 +203,10 @@ function mt:createArgs()
if not args then
return
end
- local values = self.argValues or {}
- self.argValues = nil
+ local values = {}
+ for i, value in ipairs(self.argValues) do
+ values[i] = value
+ end
if args.type == 'list' then
for _, arg in ipairs(args) do
self:createArg(arg, values)
@@ -231,6 +235,7 @@ return function (source)
source = source,
locals = {},
args = {},
+ argValues = {},
}, mt)
self:push()
return self