Added hooks to the room system

This commit is contained in:
Kayne Ruse
2015-02-17 23:37:11 +11:00
parent a538cf73d5
commit a106134dd1
4 changed files with 105 additions and 1 deletions
+17
View File
@@ -96,10 +96,27 @@ int getRoom(lua_State* L) {
return 1;
}
static int setOnCreate(lua_State* L) {
RoomManager& roomMgr = RoomManager::GetSingleton();
luaL_unref(L, LUA_REGISTRYINDEX, roomMgr.GetCreateReference());
roomMgr.SetCreateReference(luaL_ref(L, LUA_REGISTRYINDEX));
return 0;
}
static int setOnUnload(lua_State* L) {
RoomManager& roomMgr = RoomManager::GetSingleton();
luaL_unref(L, LUA_REGISTRYINDEX, roomMgr.GetUnloadReference());
roomMgr.SetUnloadReference(luaL_ref(L, LUA_REGISTRYINDEX));
return 0;
}
static const luaL_Reg roomManagerLib[] = {
{"CreateRoom", createRoom},
{"UnloadRoom", unloadRoom},
{"GetRoom", getRoom},
{"SetOnCreate", setOnCreate},
{"SetOnUnload", setOnUnload},
{nullptr, nullptr}
};