lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Something like this, in the .pkg file:

$#define dummy_C_function(arg1) C_function(tolua_S, arg1)

void dummy_C_function @ C_function(LUA_VALUE arg1);

(With  Lua 5.0, lua_Object instead of LUA_VALUE also should work.)

The macro ensures that the function is passed the lua state. This is pretty
ugly, but as of yet, there does not seem to be any other way to do this.

The last tolua release is able to handle lua_State* parameters. So one
can bind the function directly:

void C_function(lua_State *L, lua_Object arg1);

when calling this function from Lua, we do not need to specify the first parameter
(tolua automatically passes the current state).

-- waldemar