hlua
hlua copied to clipboard
How to read result of function with multiple return values
Hi,
I am executing a Lua function with LuaFunction::call_with_args. The implementation of the LuaFunction returns two boolean return values. I have assumed this will be returned to rust as a tuple (bool , bool) but this gives me LuaError(WrongType) when I execute the function.
I am executing the function like this:
func.call_with_args::<(bool, bool), _, _>((arg1, arg2))
The Lua function looks something like:
function (p1, p2)
return true, false
end
Any ideas as to what I am doing wrong?
I also tried with:
func.call_with_args::<(AnyLuaValue, AnyLuaValue), _, _>((arg1, arg2))
If I return true, true then I get back (LuaBoolean(true), LuaOther) If I return "str1", "str2", I get back (LuaString("str1"), LuaOther)
The second element of the tuple always seems to be LuaOther irrespective of what is returned from the function
Hi, any updates on this?