void Lua_getglobal (lua_state *l, const char *name);
Gets the LUA global variable, which pushes the global name of Lua to the stack.
Stack +1
void Lua_setglobal (lua_state *l, const char *name);
Set the LUA global variable, pop a value, and set it to the value of global name.
Stack-1
void Lua_createtable (lua_state *l, int narr, int nrec);
Creating an empty table and pressing the stack will pre-allocate space based on the parameters, and if you know how large the table will be, pre-allocated performance will be better.
Stack +1
void Lua_newtable (Lua_state *l);
Create empty table and press stack, equivalent to lua_createtable (L, 0, 0)
Stack +1
void Lua_gettable (lua_state *l, int index);
Gets the values in the Lua table, T[k] presses the stack, T represents the table in the stack to which index is pointing, and K represents the index that is stored at the top of the stack.
(1) Stack top index key out of the stack, (2) and then stack the value of T[k], (3) in LUA will trigger the Metamethod index event.
The stack size is the same
void Lua_settable (lua_state *l, int index);
Set the values in the LUA table, perform the t[k]=v operation, T represents the table in the stack to which index is pointing, V represents the value at the top of the stack, and K represents the index key stored under V.
(1) v and K will be out of the stack, (2) in LUA will trigger the Metamethod NewIndex event.
Stack-2
void Lua_getfield (lua_state *l, int index, const char *k);
T[K] into the stack, T represents the table in the stack to which index is pointing, triggering the Metathod.index event.
Stack +1
void Lua_setfield (lua_state *l, int index, const char *k);
For the t[k]=v operation, T represents the table in the stack to which index is pointing, and V represents the value at the top of the stack.
(1) Stack top v will be out of the stack, (2) in LUA will trigger the Metamethod.newindex event.
Stack-1
void Lua_rawget (lua_state *l, int index);
Similar to lua_gettable, but does not trigger metatable.
Stack does not change
void Lua_rawset (lua_state *l, int index);
Similar to lua_settable, but does not trigger metatable.
Stack-2