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

lua_pushcclosure[-n, +1, m] void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n); Pushes

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

lua_tointegerx[-0, +0, –] lua_Integer lua_tointegerx (lua_State *L, int index, int *isnum); Converts the

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

lua_Number typedef ... lua_Number; The type of floats in Lua. By default this type is double, but that can be changed to

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

lua_xmove[-?, +?, –] void lua_xmove (lua_State *from, lua_State *to, int n); Exchange values between different

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

lua_pushnumber[-0, +1, –] void lua_pushnumber (lua_State *L, lua_Number n); Pushes a float with value n

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

lua_setmetatable[-1, +0, –] void lua_setmetatable (lua_State *L, int index); Pops a table from the stack

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

lua_yield[-?, +?, e] int lua_yield (lua_State *L, int nresults); This function is equivalent to

2025-01-10 15:47:30