Filled out the APIs a bit

This commit is contained in:
Kayne Ruse
2014-06-21 18:24:58 +10:00
parent 3662a97475
commit a64411a567
5 changed files with 82 additions and 19 deletions
+10 -13
View File
@@ -21,28 +21,25 @@
*/
#include "room_api.hpp"
#include "room_manager.hpp"
#include "room_data.hpp"
static int getType(lua_State* L) {
RoomData* room = reinterpret_cast<RoomData*>(lua_touserdata(L, 1));
lua_pushinteger(L, static_cast<int>(room->type));
return 1;
}
//TODO: parameters
static int getRegionPager(lua_State* L) {
static int getPager(lua_State* L) {
RoomData* room = reinterpret_cast<RoomData*>(lua_touserdata(L, 1));
lua_pushlightuserdata(L, reinterpret_cast<void*>(&room->pager));
return 1;
}
//TODO: generators
static int getGenerator(lua_State* L) {
RoomData* room = reinterpret_cast<RoomData*>(lua_touserdata(L, 1));
lua_pushlightuserdata(L, reinterpret_cast<void*>(room->generator));
return 1;
}
//TODO: parameters
static const luaL_Reg roomlib[] = {
{"gettype",getType},
{"getregionpager",getRegionPager},
{"getpager",getPager},
{"getgenerator",getGenerator},
{nullptr, nullptr}
};