lua_pushcclosure

lua_pushcclosure[-n, +1, m] void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n); Pushes a new C closure onto the stack. When a C function is created, it is possible to associate some values with it, thus creating a C closure (see §4.4); these values are then accessible to the function whenever it is called. To associate values with a C function, first these values must be pushed onto the stack (when there are multiple values, the first value is pushed first). Then lua_pushcclosur

lua_pushcfunction

lua_pushcfunction[-0, +1, –] void lua_pushcfunction (lua_State *L, lua_CFunction f); Pushes a C function onto the stack. This function receives a pointer to a C function and pushes onto the stack a Lua value of type function that, when called, invokes the corresponding C function. Any function to be callable by Lua must follow the correct protocol to receive its parameters and return its results (see lua_CFunction).

lua_pushfstring

lua_pushfstring[-0, +1, e] const char *lua_pushfstring (lua_State *L, const char *fmt, ...); Pushes onto the stack a formatted string and returns a pointer to this string. It is similar to the ISO C function sprintf, but has some important differences: You do not have to allocate space for the result: the result is a Lua string and Lua takes care of memory allocation (and deallocation, through garbage collection). The conversion specifiers are quite restricted. There are no flags, widths

lua_pushglobaltable

lua_pushglobaltable[-0, +1, –] void lua_pushglobaltable (lua_State *L); Pushes the global environment onto the stack.

lua_pushinteger

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

lua_pushlightuserdata

lua_pushlightuserdata[-0, +1, –] void lua_pushlightuserdata (lua_State *L, void *p); Pushes a light userdata onto the stack. Userdata represent C values in Lua. A light userdata represents a pointer, a void*. It is a value (like a number): you do not create it, it has no individual metatable, and it is not collected (as it was never created). A light userdata is equal to "any" light userdata with the same C address.

lua_pushliteral

lua_pushliteral[-0, +1, m] const char *lua_pushliteral (lua_State *L, const char *s); This macro is equivalent to lua_pushstring, but should be used only when s is a literal string.

lua_pushlstring

lua_pushlstring[-0, +1, m] const char *lua_pushlstring (lua_State *L, const char *s, size_t len); Pushes the string pointed to by s with size len onto the stack. Lua makes (or reuses) an internal copy of the given string, so the memory at s can be freed or reused immediately after the function returns. The string can contain any binary data, including embedded zeros. Returns a pointer to the internal copy of the string.

lua_pushnil

lua_pushnil[-0, +1, –] void lua_pushnil (lua_State *L); Pushes a nil value onto the stack.

lua_pushnumber

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