summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/BLua.cc4
-rw-r--r--tests/test-Lua.cc7
2 files changed, 9 insertions, 2 deletions
diff --git a/src/BLua.cc b/src/BLua.cc
index 5bbdd07..32947cd 100644
--- a/src/BLua.cc
+++ b/src/BLua.cc
@@ -800,8 +800,8 @@ void Balau::LuaObjectFactory::pushMe(Lua & L, LuaObjectBase * o, const char * ob
pushMeta(L, "__gc", LuaStatics::collector);
L.settable(-3, true);
if (objname && *objname) {
- L.push("__objname");
- L.push(objname);
+ L.push("__type");
+ L.getglobal(objname);
L.settable(-3, true);
}
pushMethod(L, "destroy", LuaStatics::destructor);
diff --git a/tests/test-Lua.cc b/tests/test-Lua.cc
index d4c3637..06f233b 100644
--- a/tests/test-Lua.cc
+++ b/tests/test-Lua.cc
@@ -202,6 +202,13 @@ void MainTask::Do() {
}
TAssert(L.gettop() == 0);
+ L.load("return obj.__type.name == 'ObjectTest', obj.__type.new == ObjectTest.new");
+ TAssert(L.gettop() == 2);
+ TAssert(L.toboolean(1) == true);
+ TAssert(L.toboolean(2) == true);
+ L.pop();
+ L.pop();
+
IO<Input> i = new Input("tests/test-Lua.lua");
i->open();
L.load(i);