Closed codeaddicted closed 4 years ago
Hi
Please try kaguya::optional<std::string>
Hi,
awesome that seems to work.
Documenting my solution here for others to be found:
kaguya::State state;
state(R"(multresfun =function() return "Hello ", nil, " World" end)");
std::string one, three;
kaguya::optional<std::string> two;
kaguya::tie(one, two, three) = state["multresfun"]();
if(!two) {
std::cout << "two is empty!" << std::endl;
} else {
std::cout << one << two.value() << three << std::endl;
}
Hoping i used it correct :)
Best Regards & a big THANK YOU Christoph
Hi,
im trying to return
nil
in a list of multiple values from Lua to C++ and i can't get it to work.Small Example:
it results in the following error when executed:
I don't care if i need to loop over a result set and check a
type()
function instead of usingkaguya::tie
or astd::tuple
i just need to be able to returnnil
-values or at least check if a specific return value in the set isnil
Is there any way to achieve returning a
nil
value in a multipe value return?Best Regards Christoph