Selene
Selene copied to clipboard
Return multiple values from C++ to Lua
While we all know it's possible that Lua functions can return multiple values to other Lua functions and Selene can return multiple values from Lua to C++ thanks to sel::Tie
, is there any way with Selene to pass multiple values from C++ to Lua? The readme/manual doesn't say anything about that, it only mentions multi-value returns from Lua to C++.
If that's not possible at the moment, could a feature be added that we can use sel::Tie
not only to recieve multiple-value data from Lua, but to also send multiple values from C++ to Lua? For example:
C++
sel::Tie<int,int,int> CoordinatePoint::getCoordinates() {
return sel::Tie(this->X, this->Y, this->Z);
}
and in Lua
a, b, c = cpp_getCoordinates()
-- calls previously registered returnCoordinates() C++ function
-- and sets a, b and c according to the sel::Tie returned from C++
std::tuple<int,int,int>