function foo(a)
-- ...
return a, b
end
I got this function which returns a and b. Is it possible to register a C function using lua_register() that returns multiple values the same way? Or should I resort to push a table to the stack instead?
lua multiple return values
Yes,
leave the arguments that you want to return on the stack and let the C function return the numbers of arguments you want to return to lua
leave the arguments that you want to return on the stack and let the C function return the numbers of arguments you want to return to lua
// psudeo
int cfunction(lua_State * state)
{
push(arg1)
push(arg2)
return 2;
}
Blekinge Institute of Technology
Twitter [twitter]devmoon[/twitter]
Homepage http://devmoon.se
Stream http://twitch.tv/devmoon
Twitter [twitter]devmoon[/twitter]
Homepage http://devmoon.se
Stream http://twitch.tv/devmoon
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement