Established a connection between the Region objects and lua

This commit is contained in:
Kayne Ruse
2014-03-28 04:11:34 +11:00
parent 38b603fc8f
commit 4cff57fe71
5 changed files with 58 additions and 4 deletions
+47 -1
View File
@@ -21,7 +21,53 @@
*/
#include "region_api.hpp"
#include "region.hpp"
static int setTile(lua_State* L) {
// Region* ptr = lua_touserdata(L, 1);
// ptr->SetTile
}
static int getTile(lua_State* L) {
//TODO
}
static int getWidth(lua_State* L) {
//TODO
}
static int getHeight(lua_State* L) {
//TODO
}
static int getDepth(lua_State* L) {
//TODO
}
static int getX(lua_State* L) {
Region* ptr = (Region*)lua_touserdata(L, 1);
lua_pushinteger(L, ptr->GetX());
return 1;
}
static int getY(lua_State* L) {
Region* ptr = (Region*)lua_touserdata(L, 1);
lua_pushinteger(L, ptr->GetY());
return 1;
}
static const luaL_Reg regionlib[] = {
{"SetTile",setTile},
{"GetTile",getTile},
{"GetWidth",getWidth},
{"GetHeight",getHeight},
{"GetDepth",getDepth},
{"GetX",getX},
{"GetY",getY},
{nullptr, nullptr}
};
LUAMOD_API int luaopen_regionapi(lua_State* L) {
//TODO: stuff
luaL_newlib(L, regionlib);
return 1;
}
+1 -1
View File
@@ -24,7 +24,7 @@
#include "lua/lua.hpp"
#define LUA_REGIONLIBNAME "region"
#define LUA_REGIONLIBNAME "Region"
LUAMOD_API int luaopen_regionapi(lua_State* L);
#endif