Quote:Original post by Elspin
So, does this mean that it will act as a return value in lua, and that has been the purpose of the function?
Function calls are made via stack. Doesn't matter which way, C to Lua or vice versa, or within Lua.
lua_to... query the parameters on stack.
lua_push... puts something on stack.
lua_pop removes something from stack.
The convention is, that executed function pushes results on stack, and returns number of return values. In Lua, function can return multiple values. This is how Lua calls functions, either its own, or external.
If an error happens, you push a string with description of error and call lua_error() - this would be equivalent of throwing an exception.