userdata metatable is loaded smoothly

This commit is contained in:
Kayne Ruse
2015-03-27 20:42:36 +11:00
parent 29ccb982e6
commit 9a5c447d0c
3 changed files with 26 additions and 15 deletions
+1 -11
View File
@@ -80,17 +80,7 @@ void ServerApplication::Init(int argc, char* argv[]) {
std::cout << "Initialized lua" << std::endl;
//create the userdata metatable
lua_pushlightuserdata(luaState, nullptr); //userdata
lua_createtable(luaState, 1, 0); //table
//__index
lua_pushstring(luaState, "__index");
lua_pushcfunction(luaState, userdataIndex);
lua_settable(luaState, -3);
//set in the object
lua_setmetatable(luaState, -2); //set the metatable for userdata
lua_pop(luaState, 1); //pop the userdata
createUserdataMetatable(luaState);
std::cout << "\tCreated userdata metatable" << std::endl;