I'm implementing lua api (5.1) in C++ and got problem, couldn't pass lua function as paramater in c++ function called from lua. Example (Main function is called from C++):
Lua:
function Main()
HookEntityFunction("player", 1, PlayerSpawn); -- << is this normal?
end
function PlayerSpawn()
end
C++:
int HookEntityFunction(lua_State *L)
{
lua_CFunction F = lua_tocfunction(L, 3); -- << how to call it?
}