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

lua_numbertointeger int lua_numbertointeger (lua_Number n, lua_Integer *p); Converts a Lua float to a Lua integer. This macro assumes

2025-01-10 15:47:30
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_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_isboolean
  • References/Lua/Lua/API/Functions and Types

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

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

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

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

lua_pop[-n, +0, –] void lua_pop (lua_State *L, int n); Pops n elements from the stack.

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

lua_pushlightuserdata[-0, +1, –] void lua_pushlightuserdata (lua_State *L, void *p); Pushes a light userdata

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

lua_pushthread[-0, +1, –] int lua_pushthread (lua_State *L); Pushes the thread represented by L

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

lua_settop[-?, +?, –] void lua_settop (lua_State *L, int index); Accepts any index, or 0, and sets the

2025-01-10 15:47:30