LUA_PUSHCFUNCTION(3) Library Functions Manual LUA_PUSHCFUNCTION(3)

lua_pushcfunctionpushes a C function onto the stack, function indicator [-0, +1, m]

#include <lua.h>

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 registered in Lua must follow the correct protocol to receive its parameters and return its results (see lua_CFunction(3)).

lua_pushcfunction is defined as a macro:

#define lua_pushcfunction(L,f)  lua_pushcclosure(L,f,0)

lua_CFunction(3)

Roberto Ierusalimschy, Luiz Henrique de Figueiredo, and Waldemar Celes, Lua 5.1 Reference Manual.

The lua_pushcfunction() manual page is based on Lua Reference Manual 5.1 and was created by Sergey Bronnikov.

July 20, 2022 Debian