moonsharp
moonsharp copied to clipboard
Added support for converting to and from System.Tuple.
To send a Tuple to Lua, simply pass it as a global. ie:
script.Globals["a_tuple"] = Tuple.Create(1, 2, 3);
You can then unpack it in Lua normally:
local a, b, c = a_tuple
To return or set a Tuple from Lua, just surround the tuple values in curly braces:
some_clr_class.some_tuple = {42, 'the meaning of life', true}
If you would like to get a Tuple from a DynValue, you can use the generic TupleOf methods:
var aTupleFromLua = dynValue.TupleOf<int, string, bool>() // returns a System.Tuple<int, string, bool>
This is a nice feature to have. Any chance of it getting it included?
Or is there a workaround to allow local a, b, c = a_tuple
in Lua to work with MoonSharp?
@AidanMcK Need to get the conflicts resolved and then will merge, I will take a look in a bit.
that sure is a long bit