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

lua_getuservalue[-0, +1, –] int lua_getuservalue (lua_State *L, int index); Pushes onto the stack the Lua

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

lua_seti[-1, +0, e] void lua_seti (lua_State *L, int index, lua_Integer n); Does the equivalent

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

lua_getglobal[-0, +1, e] int lua_getglobal (lua_State *L, const char *name); Pushes onto the stack

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

lua_rawequal[-0, +0, –] int lua_rawequal (lua_State *L, int index1, int index2); Returns 1 if the two values

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