*lua_setallocf()*
>c
void lua_setallocf (lua_State *L, lua_Alloc f, void *ud);
<
Changes the allocator function of a given state to `f` with user data
`ud`.
lua_setfenv *lua_setfenv()*
>c
int lua_setfenv (lua_State *L, int index);
<
Pops a table from the stack and sets it as the new environment for the
value at the given index. If the value at the given index is neither a
function nor a thread nor a userdata, `lua_setfenv` returns 0.
Otherwise it returns 1.
lua_setfield *lua_setfield()*
>c
void lua_setfield (lua_State *L, int index, const char *k);
<
Does the equivalent to `t[k] = v`, where `t` is the value at the given
valid index `index` and `v` is the value at the top of the stack.
This function pops the value from the stack. As in Lua, this function
may trigger a metamethod for the "newindex" event (see
|lua-metatable|).
lua_setglobal *lua_setglobal()*
>c
void lua_setglobal (lua_State *L, const char *name);
<
Pops a value from the stack and sets it as the new value of global
`name`. It is defined as a macro:
>c
#define lua_setglobal(L,s) lua_setfield(L, LUA_GLOBALSINDEX, s)
<
lua_setmetatable *lua_setmetatable()*
>c
int lua_setmetatable (lua_State *L, int index);
<
Pops a table from the stack and sets it as the new metatable for the
value at the given acceptable index.
lua_settable *lua_settable()*
>c
void lua_settable (lua_State *L, int index);
<
Does the equivalent to `t[k] = v`, where `t` is the value at the given
valid index `index`, `v` is the value at the top of the stack, and `k`
is the value just below the top.
This function pops both the key and the value from the stack. As in
Lua, this function may trigger a metamethod for the "newindex" event
(see |lua-metatable|).
lua_settop *lua_settop()*
>c
void lua_settop (lua_State *L, int index);
<
Accepts any acceptable index, or 0, and sets the stack top to this
index. If the new top is larger than the old one, then the new
elements are filled with `nil`. If `index` is 0, then all stack
elements are removed.
lua_State *lua_State*
>c
typedef struct lua_State lua_State;
<
Opaque structure that keeps the whole state of a Lua interpreter. The
Lua library is fully reentrant: it has no global variables. All
information about a state is kept in this structure.
A pointer to this state must be passed as the first argument to every
function in the library, except to `lua_newstate` (see
|lua_newstate()|), which creates a Lua state from scratch.
lua_status *lua_status()*
>c
int lua_status (lua_State *L);
<
Returns the status of the thread `L`.
The status can be 0 for a normal thread, an error code if the thread
finished its execution with an error, or `LUA_YIELD` if the thread is
suspended.
lua_toboolean *lua_toboolean()*
>c
int lua_toboolean (lua_State *L, int index);
<
Converts the Lua value at the given acceptable index to a C boolean
value (0 or 1). Like all tests in Lua, `lua_toboolean` returns 1 for
any Lua value different from `false` and `nil`; otherwise it returns
0. It also returns 0 when called with a non-valid index. (If you want
to accept only actual boolean values, use `lua_isboolean`