summaryrefslogtreecommitdiff
path: root/lib/BLua.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/BLua.cc')
-rw-r--r--lib/BLua.cc29
1 files changed, 25 insertions, 4 deletions
diff --git a/lib/BLua.cc b/lib/BLua.cc
index 8d89802..1840791 100644
--- a/lib/BLua.cc
+++ b/lib/BLua.cc
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: BLua.cc,v 1.43 2007-05-27 13:19:29 pixel Exp $ */
+/* $Id: BLua.cc,v 1.44 2007-05-30 06:28:53 pixel Exp $ */
#include <stdlib.h>
#include "BLua.h"
@@ -908,6 +908,14 @@ void Lua::dumpvars_r(Handle * h, int i, int depth) throw (GeneralException) {
t = "-- [function() ... end]\n";
dump_value = false;
break;
+ case LUA_TUSERDATA:
+ t = "-- [userdata]\n";
+ dump_value = false;
+ break;
+ case LUA_TTHREAD:
+ t = "-- [thread]\n";
+ dump_value = false;
+ break;
default:
throw LuaException("Internal error: got unknow index for key while dumpvars.");
}
@@ -919,8 +927,10 @@ void Lua::dumpvars_r(Handle * h, int i, int depth) throw (GeneralException) {
continue;
}
- // let's look at the value: if it's a function, we can't dump it.
- if (lua_type(L, -1) == LUA_TFUNCTION)
+ // let's look at the value: if it's a function, a userdata or a thread, we can't dump it.
+ if ((lua_type(L, -1) == LUA_TFUNCTION) ||
+ (lua_type(L, -1) == LUA_TUSERDATA) ||
+ (lua_type(L, -1) == LUA_TTHREAD))
(*h) << "-- ";
(*h) << t;
@@ -952,6 +962,12 @@ void Lua::dumpvars_r(Handle * h, int i, int depth) throw (GeneralException) {
case LUA_TFUNCTION:
(*h) << "function() ... end\n";
break;
+ case LUA_TUSERDATA:
+ (*h) << "userdata ...\n";
+ break;
+ case LUA_TTHREAD:
+ (*) << "thread ...\n";
+ break;
default:
throw LuaException("Internal error: got unknow index for value while dumpvars.");
}
@@ -1142,7 +1158,7 @@ void LuaObject::push(Lua * L) throw (GeneralException) {
pushed = true;
}
-void LuaObject::pushme(Lua * L, void * o, bool obj) {
+void LuaObject::pushme(Lua * L, void * o, bool obj, const String & objname) {
void ** u;
bool * b;
L->lock();
@@ -1152,6 +1168,11 @@ void LuaObject::pushme(Lua * L, void * o, bool obj) {
b = (bool *) (u + 1);
*b = obj;
L->settable(-3, true);
+ if (objname != "") {
+ L->push("__objname");
+ L->push(objname);
+ L->settable(-3, true);
+ }
L->unlock();
}