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_arith
  • References/Lua/Lua/API/Functions and Types

lua_arith[-(2|1), +1, e] void lua_arith (lua_State *L, int op); Performs an arithmetic or bitwise

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

lua_newthread[-0, +1, m] lua_State *lua_newthread (lua_State *L); Creates a new thread, pushes

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

lua_newstate[-0, +0, –] lua_State *lua_newstate (lua_Alloc f, void *ud); Creates a new thread running in

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

lua_Reader typedef const char * (*lua_Reader) (lua_State *L, void *data,

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_concat
  • References/Lua/Lua/API/Functions and Types

lua_concat[-n, +1, e] void lua_concat (lua_State *L, int n); Concatenates the n values

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

lua_pushvalue[-0, +1, –] void lua_pushvalue (lua_State *L, int index); Pushes a copy of the element at

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

lua_pushliteral[-0, +1, m] const char *lua_pushliteral (lua_State *L, const char *s); This macro

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

lua_setallocf[-0, +0, –] void lua_setallocf (lua_State *L, lua_Alloc f, void *ud); Changes the allocator

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

lua_Writer typedef int (*lua_Writer) (lua_State *L, const void* p, size_t sz,

2025-01-10 15:47:30