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

lua_State typedef struct lua_State lua_State; An opaque structure that points to a thread and indirectly (through the thread) to the

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

lua_typename[-0, +0, –] const char *lua_typename (lua_State *L, int tp); Returns the name of the type encoded

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

lua_pushfstring[-0, +1, e] const char *lua_pushfstring (lua_State *L, const char *fmt, ...); Pushes

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

lua_next[-1, +(2|0), e] int lua_next (lua_State *L, int index); Pops a key from the stack, and

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

lua_pushinteger[-0, +1, –] void lua_pushinteger (lua_State *L, lua_Integer n); Pushes an integer with value

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

lua_getallocf[-0, +0, –] lua_Alloc lua_getallocf (lua_State *L, void **ud); Returns the memory-allocation

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

lua_rawsetp[-1, +0, m] void lua_rawsetp (lua_State *L, int index, const void *p); Does the equivalent

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

lua_isstring[-0, +0, –] int lua_isstring (lua_State *L, int index); Returns 1 if the value at the given

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

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

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

lua_createtable[-0, +1, m] void lua_createtable (lua_State *L, int narr, int nrec); Creates a

2025-01-10 15:47:30