A C function receives a Lua state and returns an integer, the number of values it wants to return to Lua.

    As an example, the following function receives a variable number of numerical arguments and returns their average and sum:

    which receives the name the function will have in Lua and a pointer to the function. Thus, the C function above may be registered in Lua as by calling