[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Gets function name from the stack
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Thu, 27 Mar 2008 22:30:02 -0300
> 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");