4.8 – Functions and Types[-o, +p, x]

Here we list all functions and types from the C API in alphabetical order. Each function has an indicator like this:

The first field, o, is how many elements the function pops from the stack. The second field, p, is how many elements the function pushes onto the stack. (Any function always pushes its results after popping its arguments.) A field in the form x|y means the function can push (or pop) x or y elements, depending on the situation; an interrogation mark '?' means that we cannot know how many elements the function pops/pushes by looking only at its arguments (e.g., they may depend on what is on the stack). The third field, x, tells whether the function may raise errors: '-' means the function never raises any error; 'm' means the function may raise out-of-memory errors and errors running a __gc metamethod; 'e' means the function may raise any errors (it can run arbitrary Lua code, either directly or through metamethods); 'v' means the function may raise an error on purpose.

lua_getmetatable
  • References/Lua/Lua/API/Functions and Types

lua_getmetatable[-0, +(0|1), –] int lua_getmetatable (lua_State *L, int index); If the value at the given

2025-01-10 15:47:30
lua_atpanic
  • References/Lua/Lua/API/Functions and Types

lua_atpanic[-0, +0, –] lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf); Sets a new panic

2025-01-10 15:47:30
lua_isnone
  • References/Lua/Lua/API/Functions and Types

lua_isnone[-0, +0, –] int lua_isnone (lua_State *L, int index); Returns 1 if the given index is not valid

2025-01-10 15:47:30
lua_setfield
  • References/Lua/Lua/API/Functions and Types

lua_setfield[-1, +0, e] void lua_setfield (lua_State *L, int index, const char *k); Does the equivalent

2025-01-10 15:47:30
lua_replace
  • References/Lua/Lua/API/Functions and Types

lua_replace[-1, +0, –] void lua_replace (lua_State *L, int index); Moves the top element into the given

2025-01-10 15:47:30
lua_upvalueindex
  • References/Lua/Lua/API/Functions and Types

lua_upvalueindex[-0, +0, –] int lua_upvalueindex (int i); Returns the pseudo-index that represents the

2025-01-10 15:47:30
lua_newuserdata
  • References/Lua/Lua/API/Functions and Types

lua_newuserdata[-0, +1, m] void *lua_newuserdata (lua_State *L, size_t size); This function allocates

2025-01-10 15:47:30
lua_version
  • References/Lua/Lua/API/Functions and Types

lua_version[-0, +0, –] const lua_Number *lua_version (lua_State *L); Returns the address of the version

2025-01-10 15:47:30
lua_register
  • References/Lua/Lua/API/Functions and Types

lua_register[-0, +0, e] void lua_register (lua_State *L, const char *name, lua_CFunction f); Sets

2025-01-10 15:47:30
lua_remove
  • References/Lua/Lua/API/Functions and Types

lua_remove[-1, +0, –] void lua_remove (lua_State *L, int index); Removes the element at the given valid

2025-01-10 15:47:30