Set the values for packets, and added getRoom()

This commit is contained in:
Kayne Ruse
2014-11-26 07:11:27 +11:00
parent fa0d232727
commit 01461deaa5
2 changed files with 48 additions and 33 deletions
+16 -1
View File
@@ -44,11 +44,26 @@ int unloadRoom(lua_State* L) {
return 0;
}
//TODO: lua API RoomManager.GetRoom(uid)
int getRoom(lua_State* L) {
//TODO: integer vs name for getRoom()
RoomManager& roomMgr = RoomManager::GetSingleton();
RoomData* room = roomMgr.Get(lua_tointeger(L, 1));
if (room) {
lua_pushlightuserdata(L, static_cast<void*>(room));
}
else {
lua_pushnil(L);
}
return 1;
}
static const luaL_Reg roomManagerLib[] = {
{"CreateRoom", createRoom},
{"UnloadRoom", unloadRoom},
{"GetRoom", getRoom},
{nullptr, nullptr}
};