mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-06-05 19:04:26 +00:00
encapsulation closure
This commit is contained in:
@@ -115,4 +115,11 @@ namespace LuaG
|
||||
{
|
||||
lua_pop(_state, -1);
|
||||
}
|
||||
|
||||
void State::registerClosure(void *ptr, std::string funcName, lua_CFunction fn)
|
||||
{
|
||||
lua_pushlightuserdata(_state, ptr);
|
||||
lua_pushcclosure(_state, fn, 1);
|
||||
lua_setglobal(_state, funcName.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,5 +78,7 @@ namespace LuaG
|
||||
|
||||
//! @brief Pop last value on the stack
|
||||
void popLast(void);
|
||||
|
||||
void registerClosure(void *ptr, std::string funcName, lua_CFunction fn);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user