[-(0|1), +0, -]
const char *lua_setupvalue (lua_State *L, int funcindex, int n);
Sets the value of a closure's upvalue.
It assigns the value at the top of the stack
to the upvalue and returns its name.
It also pops the value from the stack.
n are as in the
NULL (and pops nothing)
when the index is greater than the number of upvalues.
The auxiliary library provides several convenient functions
to interface C with Lua.
While the basic API provides the primitive functions for all
interactions between C and Lua,
the auxiliary library provides higher-level functions for some
All functions from the auxiliary library
are defined in header file
have a prefix
All functions in the auxiliary library are built on
top of the basic API,
and so they provide nothing that cannot be done with this API.
Several functions in the auxiliary library are used to
check C function arguments.
Their names are always
All of these functions throw an error if the check is not satisfied.
Because the error message is formatted for arguments
bad argument #1"),
you should not use these functions for other stack values.