invokes the corresponding C function.
Any function to be registered in Lua must follow the correct protocol
to receive its parameters and return its results (see
|lua_CFunction|).
`lua_pushcfunction` is defined as a macro:
>c
#define lua_pushcfunction(L,f) lua_pushcclosure(L,f,0)
<
lua_pushfstring *lua_pushfstring()*
>c
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 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, or precisions. The conversion specifiers can only be `%%`
(inserts a `%` in the string), `%s` (inserts a zero-terminated
string, with no size restrictions), `%f` (inserts a
`lua_Number`), `%p` (inserts a pointer as a hexadecimal numeral),
`%d` (inserts an `int`), and `%c` (inserts an `int` as a
character).
lua_pushinteger *lua_pushinteger()*
>c
void lua_pushinteger (lua_State *L, lua_Integer n);
<
Pushes a number with value `n` onto the stack.
lua_pushlightuserdata *lua_pushlightuserdata()*
>c
void lua_pushlightuserdata (lua_State *L, void *p);
<
Pushes a light userdata onto the stack.
*lua-lightuserdata*
Userdata represents C values in Lua. A light userdata represents a
pointer. 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_pushlstring *lua_pushlstring()*
>c
void 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 embedded zeros.
lua_pushnil *lua_pushnil()*
>c
void lua_pushnil (lua_State *L);
<
Pushes a nil value onto the stack.
lua_pushnumber *lua_pushnumber()*
>c
void lua_pushnumber (lua_State *L, lua_Number n);
<
Pushes a number with value `n` onto the stack.
lua_pushstring *lua_pushstring()*
>c
void lua_pushstring (lua_State *L, const char *s);
<
Pushes the zero-terminated string pointed to by `s` 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 cannot contain embedded zeros; it is assumed to
end at the first zero.
lua_pushthread *lua_pushthread()*
>c
int lua_pushthread (lua_State *L);
<
Pushes the thread represented by `L` onto the stack. Returns 1 if this
thread is the main thread of its state.
lua_pushvalue *lua_pushvalue()*
>c
void lua_pushvalue (lua_State *L, int index);
<
Pushes a copy of the element at the given valid index onto the stack.
lua_pushvfstring *lua_pushvfstring()*
>c
const char *lua_pushvfstring (lua_State *L,