You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some Lua APIs can pass back multiple values that are not a list. They may look like this:
x, y=cursor()
Currently one can't implement this in Rust.
Solution
What I'd suggest is to add a variant to ScriptValue called Tuple(Vec<ScriptValue>) which holds the same data type as ScriptValue::List then pass back the multiple values.
Work Around
The work around I've used is to implement _cursor() in Rust that returns a list and then in Lua add the following function:
functioncursor()
locall=_cursor()
returnl[1], l[2]
end
Considerations
I don't know if Lua is the only supported language that supports multiple return values. But one would need a policy on what to do if the language does not support it. I'd suggest languages that don't support multiple return values should treat ScriptValue::List and ScriptValue::Tuple the same.
The text was updated successfully, but these errors were encountered:
Problem
Some Lua APIs can pass back multiple values that are not a list. They may look like this:
Currently one can't implement this in Rust.
Solution
What I'd suggest is to add a variant to
ScriptValue
calledTuple(Vec<ScriptValue>)
which holds the same data type asScriptValue::List
then pass back the multiple values.Work Around
The work around I've used is to implement
_cursor()
in Rust that returns a list and then in Lua add the following function:Considerations
I don't know if Lua is the only supported language that supports multiple return values. But one would need a policy on what to do if the language does not support it. I'd suggest languages that don't support multiple return values should treat
ScriptValue::List
andScriptValue::Tuple
the same.The text was updated successfully, but these errors were encountered: