summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/libs/lua53/basic.lni20
-rw-r--r--server/src/matcher/vm.lua17
2 files changed, 36 insertions, 1 deletions
diff --git a/server/libs/lua53/basic.lni b/server/libs/lua53/basic.lni
index ae25c68d..bbd6139e 100644
--- a/server/libs/lua53/basic.lni
+++ b/server/libs/lua53/basic.lni
@@ -203,6 +203,26 @@ default = 0
[next]
[pairs]
+[[.args]]
+name = 't'
+type = 'table'
+[[.returns]]
+name = 'next'
+type = 'function'
+returns = {
+ 1 = {
+ name = 'key',
+ },
+ 2 = {
+ name = 'object',
+ },
+}
+[[.returns]]
+name = 't'
+type = 'table'
+[[.returns]]
+name = 'nil'
+type = 'nil'
[pcall]
diff --git a/server/src/matcher/vm.lua b/server/src/matcher/vm.lua
index 18e1ddd3..e5230015 100644
--- a/server/src/matcher/vm.lua
+++ b/server/src/matcher/vm.lua
@@ -316,6 +316,8 @@ function mt:getLibValue(lib)
value = self:createNumber(lib.value)
elseif tp == 'integer' then
value = self:createInteger(lib.value)
+ elseif tp == 'nil' then
+ value = self:createNil()
else
value = self:createCustom(tp)
end
@@ -600,7 +602,20 @@ end
function mt:doIn(action)
self.scope:push()
- local values = self:unpackList(action.exp)
+ local func
+ local list = {
+ type = 'list'
+ }
+ if action.exp.type == 'list' then
+ func = self:getExp(action.exp[1])
+ for i = 2, #action.exp do
+ list[i-1] = action.exp[i]
+ end
+ else
+ func = self:getExp(action.exp)
+ end
+ local args = self:unpackList(list)
+ local values = self:call(func, args)
self:forList(action.arg, function (arg)
local var = self:createLocal(arg[1], arg)
self:setValue(var, table.remove(values, 1))