Removed trace statements, moved a couple util files
This commit is contained in:
@@ -15,10 +15,7 @@ roomManagerAPI.SetOnCreate(function(room, index)
|
|||||||
|
|
||||||
roomAPI.SetOnTick(room, function(room)
|
roomAPI.SetOnTick(room, function(room)
|
||||||
roomAPI.ForEachCharacter(room, function(character)
|
roomAPI.ForEachCharacter(room, function(character)
|
||||||
--testing the metatables
|
--
|
||||||
local meta = getmetatable(character)
|
|
||||||
print("", "userdata metatable: ", meta)
|
|
||||||
print(character["trying"])
|
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
@@ -36,14 +33,4 @@ roomAPI.Initialize(underworld, mapSaver.Load, mapSaver.Save, mapMaker.DebugGrass
|
|||||||
--call the monstrosity
|
--call the monstrosity
|
||||||
doorUtility.createDoorPair("pair 1", overworld, 0, -64, underworld, 0, 0)
|
doorUtility.createDoorPair("pair 1", overworld, 0, -64, underworld, 0, 0)
|
||||||
|
|
||||||
--testing the metatables
|
|
||||||
print("debug")
|
|
||||||
overworld["key"] = "value"
|
|
||||||
local key = overworld["key"]
|
|
||||||
print("", "result: ", key)
|
|
||||||
|
|
||||||
local key = underworld["key"]
|
|
||||||
print("", "result: ", key)
|
|
||||||
--end test
|
|
||||||
|
|
||||||
print("Finished the lua script")
|
print("Finished the lua script")
|
||||||
|
|||||||
@@ -21,13 +21,9 @@
|
|||||||
*/
|
*/
|
||||||
#include "userdata.hpp"
|
#include "userdata.hpp"
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#define METAMETA "__metameta"
|
#define METAMETA "__metameta"
|
||||||
|
|
||||||
static int index(lua_State* L) {
|
static int index(lua_State* L) {
|
||||||
std::cout << "debug: index" << std::endl;
|
|
||||||
|
|
||||||
//get __metameta
|
//get __metameta
|
||||||
lua_getmetatable(L, 1); //get the userdata metatable
|
lua_getmetatable(L, 1); //get the userdata metatable
|
||||||
lua_pushstring(L, METAMETA); //push the __metameta name
|
lua_pushstring(L, METAMETA); //push the __metameta name
|
||||||
@@ -39,7 +35,6 @@ static int index(lua_State* L) {
|
|||||||
|
|
||||||
//table doesn't exist yet
|
//table doesn't exist yet
|
||||||
if (lua_isnil(L, -1)) {
|
if (lua_isnil(L, -1)) {
|
||||||
std::cout << "debug: index (no table)" << std::endl;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,8 +47,6 @@ static int index(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int newindex(lua_State* L) {
|
static int newindex(lua_State* L) {
|
||||||
std::cout << "debug: newindex" << std::endl;
|
|
||||||
|
|
||||||
//get __metameta
|
//get __metameta
|
||||||
lua_getmetatable(L, 1); //get the userdata metatable
|
lua_getmetatable(L, 1); //get the userdata metatable
|
||||||
lua_pushstring(L, METAMETA); //push the __metameta name
|
lua_pushstring(L, METAMETA); //push the __metameta name
|
||||||
@@ -65,7 +58,6 @@ static int newindex(lua_State* L) {
|
|||||||
|
|
||||||
//if this table doesn't exist yet
|
//if this table doesn't exist yet
|
||||||
if (lua_isnil(L, -1)) {
|
if (lua_isnil(L, -1)) {
|
||||||
std::cout << "debug: newindex (new table)" << std::endl;
|
|
||||||
lua_pop(L, 1); //pop nil
|
lua_pop(L, 1); //pop nil
|
||||||
|
|
||||||
lua_pushvalue(L, 1); //copy userdata (key)
|
lua_pushvalue(L, 1); //copy userdata (key)
|
||||||
Reference in New Issue
Block a user