diff options
author | pixel <pixel> | 2007-05-30 06:28:46 +0000 |
---|---|---|
committer | pixel <pixel> | 2007-05-30 06:28:46 +0000 |
commit | 6c16139384a26103a37cbdd82138440177eebf0e (patch) | |
tree | d5f6241ee6d918fadb4c4c46f95c67e94d3c79ed /lib | |
parent | 7afc045c94fdf9b4f8b0c6afee6ab98edb916e3f (diff) |
Introducing objnames.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/BLua.cc | 29 | ||||
-rw-r--r-- | lib/LuaConfigFile.cc | 6 | ||||
-rw-r--r-- | lib/LuaHandle.cc | 13 | ||||
-rw-r--r-- | lib/LuaHttp.cc | 4 | ||||
-rw-r--r-- | lib/LuaRegex.cc | 4 | ||||
-rw-r--r-- | lib/LuaSQL.cc | 2 |
6 files changed, 44 insertions, 14 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(); } diff --git a/lib/LuaConfigFile.cc b/lib/LuaConfigFile.cc index b8081c4..08727fa 100644 --- a/lib/LuaConfigFile.cc +++ b/lib/LuaConfigFile.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: LuaConfigFile.cc,v 1.4 2007-05-29 14:27:52 pixel Exp $ */ +/* $Id: LuaConfigFile.cc,v 1.5 2007-05-30 06:28:53 pixel Exp $ */ #include "LuaConfigFile.h" @@ -64,7 +64,7 @@ class sLua_ConfigFile : public Base { }; void LuaConfigFile::pushmembers(Lua * L) { - pushme(L, c); + pushme(L, c, true, "ConfigFile"); PUSH_METAMETHOD(ConfigFile, CONFIGFILE_INDEX); PUSH_METAMETHOD(ConfigFile, CONFIGFILE_NEWINDEX); @@ -137,7 +137,7 @@ class sLua_ConfigSectionContents : public Base { }; void LuaConfigSectionContents::pushmembers(Lua * L) { - pushme(L, c); + pushme(L, c, true, "ConfigSectionContents"); PUSH_METAMETHOD(ConfigSectionContents, CONFIGSECTIONCONTENTS_INDEX); PUSH_METAMETHOD(ConfigSectionContents, CONFIGSECTIONCONTENTS_NEWINDEX); diff --git a/lib/LuaHandle.cc b/lib/LuaHandle.cc index 6a7fc33..05f2ced 100644 --- a/lib/LuaHandle.cc +++ b/lib/LuaHandle.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: LuaHandle.cc,v 1.18 2006-02-02 14:09:48 pixel Exp $ */ +/* $Id: LuaHandle.cc,v 1.19 2007-05-30 06:28:53 pixel Exp $ */ #include "LuaHandle.h" @@ -615,10 +615,16 @@ int sLuaHandle::exists(lua_State * __L) { void LuaInput::pushmembers(Lua * L) { LuaHandle::pushmembers(L); + L->push("__objname"); + L->push("Handle:Input"); + L->settable(-3, true); } void LuaOutput::pushmembers(Lua * L) { LuaHandle::pushmembers(L); + L->push("__objname"); + L->push("Handle:Output"); + L->settable(-3, true); } void LuaBuffer::pushmembers(Lua * L) { @@ -627,10 +633,13 @@ void LuaBuffer::pushmembers(Lua * L) { pushmeta(L, "__newindex", sLuaHandle::bnewindex); pushit(L, "wtell", sLuaHandle::btell); pushit(L, "wseek", sLuaHandle::bseek); + L->push("__objname"); + L->push("Handle:Buffer"); + L->settable(-3, true); } void LuaHandle::pushmembers(Lua * L) { - pushme(L, h); + pushme(L, h, true, "Handle"); pushit(L, "read", &sLuaHandle::read); pushit(L, "write", &sLuaHandle::write); diff --git a/lib/LuaHttp.cc b/lib/LuaHttp.cc index 8d24416..bebe06d 100644 --- a/lib/LuaHttp.cc +++ b/lib/LuaHttp.cc @@ -46,7 +46,7 @@ class sLua_LuaDomain : public Base { }; void LuaLuaDomain::pushmembers(Lua * L) { - pushme(L, d); + pushme(L, d, true, "LuaDomain"); PUSH_METHOD(LuaDomain, LUADOMAIN_ONTOP); } @@ -99,7 +99,7 @@ class sLua_HttpResponse : public Base { }; void LuaHttpResponse::pushmembers(Lua * L) { - pushme(L, r); + pushme(L, r, true, "HttpResponse"); PUSH_METAMETHOD(HttpResponse, HTTPRESPONSE_INDEX); PUSH_METAMETHOD(HttpResponse, HTTPRESPONSE_NEWINDEX); diff --git a/lib/LuaRegex.cc b/lib/LuaRegex.cc index a3cf265..e4c5148 100644 --- a/lib/LuaRegex.cc +++ b/lib/LuaRegex.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: LuaRegex.cc,v 1.1 2005-03-31 16:23:05 pixel Exp $ */ +/* $Id: LuaRegex.cc,v 1.2 2007-05-30 06:28:53 pixel Exp $ */ #include "LuaRegex.h" @@ -52,7 +52,7 @@ class sLua_Regex : public Base { }; void LuaRegex::pushmembers(Lua * L) { - pushme(L, r); + pushme(L, r, true, "Regex"); PUSH_METHOD(Regex, REGEX_MATCH); } diff --git a/lib/LuaSQL.cc b/lib/LuaSQL.cc index fe4bc73..f0659af 100644 --- a/lib/LuaSQL.cc +++ b/lib/LuaSQL.cc @@ -56,7 +56,7 @@ class sLua_SQLConnection : public Base { }; void LuaSQLConnection::pushmembers(Lua * L) { - pushme(L, c); + pushme(L, c, true, "SQLConnection"); PUSH_METHOD(SQLConnection, SQLCONNECTION_QUERY); PUSH_METHOD(SQLConnection, SQLCONNECTION_NUMROWS); |