-
-
Notifications
You must be signed in to change notification settings - Fork 49
Open
Description
Problem
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:
function cursor()
local l = _cursor()
return l[1], l[2]
endConsiderations
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.
Metadata
Metadata
Assignees
Labels
No labels