Is the function name from the call still somewhere in the lua stack or
can I somehow else retrieve the function name under which it was called ?
If you register the same C function with different names in Lua, they are
actually different objects in Lua and you can use the debug interface to find
the name it was registered. Try this:
static int F(lua_State *L)
{
lua_Debug ar;
lua_getstack(L,0,&ar);
lua_getinfo(L,"n",&ar);
printf("F called as %s\n",ar.name);
return 0;
}
lua_register(L,"F",F);
lua_register(L,"G",F);