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

lua_tostring[-0, +0, m] const char *lua_tostring (lua_State *L, int index); Equivalent to

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

lua_call[-(nargs+1), +nresults, e] void lua_call (lua_State *L, int nargs, int nresults); Calls

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

lua_pushstring[-0, +1, m] const char *lua_pushstring (lua_State *L, const char *s); Pushes the

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

lua_gettop[-0, +0, –] int lua_gettop (lua_State *L); Returns the index of the top element in the stack

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

lua_geti[-0, +1, e] int lua_geti (lua_State *L, int index, lua_Integer i); Pushes onto the stack

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

lua_isyieldable[-0, +0, –] int lua_isyieldable (lua_State *L); Returns 1 if the given coroutine can yield

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_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_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_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