for example i have this:
static int callFunction(lua_State* L)
{
int p = lua_gettop(L);
if (p == 1 && lua_isfunction(L, -1)) {
/*
* now i need something like "get the function thats in the first parametre
*/
}
return 0;
}
now i need to get the function thats in the first parametre of the function in this C++ code, sry for not being clear, i suck at explaining.
If you want to store a “pointer” to a Lua function in C++, you could just store the /name/ of the Lua function and then do as DeadMG says and call it with
lua_call, as here: http://pgl.yoyo.org/luai/i/lua_call .If you are stuck with the code you have already, it’s kind of a sticky problem; I’m not sure you can get the name of the Lua function from the stack you have. In other words, you may need to modify the code one level up from what you posted.