lua-users home
lua-l archive

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


> lua_pushcfunction(L, generic_func);
> lua_setglobal(L, "my_func2");
...
> for instance, if I do : my_func2("test"); from lua,
> I would like to receive : args count = 1 - function name = my_func2

Use the name as an upvalue to generic_func:
	lua_pushliteral(L, "my_func2");
	lua_pushcclosure(L, generic_func, 1);
	lua_setglobal(L, "my_func2");