pub unsafe extern "C" fn call(
state: lua_State,
nargs: i32,
nrets: i32,
)
Expand description
Calls a function.
To call a function you must use the following protocol: first, the function to be called is pushed onto the stack; then, the arguments to the function are pushed in direct order; that is, the first argument is pushed first.
Finally you call call
(lua_call
); nargs
is the number of arguments that you pushed onto the stack.
All arguments and the function value are popped from the stack when the function is called.
The function results are pushed onto the stack when the function returns.
The number of results is adjusted to nrets
, unless nrets
is LUA_MULTRET
.
In this case, all results from the function are pushed.
Lua takes care that the returned values fit into the stack space.
The function results are pushed onto the stack in direct order (the first result is pushed first), so that after the call the last result is on the top of the stack.
Any error inside the called function is propagated upwards (with a longjmp
).