I don't get the point why this is happening. I am using Moonsharp to run LUA scripts in my application an I created a LUA function IN(v, ...) and I'd like to itterate over the ... parameter with pairs.
IN('param1', 'param2', 'param1') -- expected it to return true
function IN(v, ...)
local args = ...
local res = true
for i, v in pairs(args) do
if valueIn == v then
res = true
break
end
end
return res
end
If it gets called I recieve the folowing exception:
"MoonSharp.Interpreter.ScriptRuntimeException" bad argument #1 to 'next' (table expected, got string)
So I decided to check if there is a string instead of a Table in my ... variable.
function args(v, ...)
return ...
end
The return value in C# is a Tuple of 2 values with 'param2' and 'param1', so it should work with pairs or ipairs, shouldn't it?
Thanks in advance.