diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2014-10-11 21:26:11 +0200 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2014-10-11 21:26:11 +0200 |
commit | 3ce1734080a7e28ef7385e8c5f22d74631041499 (patch) | |
tree | cf238c4658d38e02b7e0b928fe1e76e1d8ede5c0 /src/libluaglue | |
parent | dbb3cae7f15512b04e8a17d4f44fd5b3531a2b51 (diff) | |
download | crawler-3ce1734080a7e28ef7385e8c5f22d74631041499.tar.gz crawler-3ce1734080a7e28ef7385e8c5f22d74631041499.tar.bz2 |
playing with some more obscure lua data types
Diffstat (limited to 'src/libluaglue')
-rw-r--r-- | src/libluaglue/LuaVM.cpp | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/libluaglue/LuaVM.cpp b/src/libluaglue/LuaVM.cpp index fb40c85..e75a1c9 100644 --- a/src/libluaglue/LuaVM.cpp +++ b/src/libluaglue/LuaVM.cpp @@ -149,13 +149,34 @@ void LuaVM::dumpStackElement( lua_State *l, int i, int indent ) lua_CFunction f = lua_tocfunction( l, i ); char buf[33]; snprintf( buf, 32, "function[%016" PRIxPTR "]", (uintptr_t)f ); + // TODO: int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar); cout << "LUA_TFUNCTION " << buf; break; } -//#define LUA_TLIGHTUSERDATA 2 -//#define LUA_TUSERDATA 7 -//#define LUA_TTHREAD 8 + case LUA_TLIGHTUSERDATA: { + void *p = lua_touserdata( l, i ); + char buf[33]; + snprintf( buf, 32, "void *[%016" PRIxPTR "]", (uintptr_t)p ); + cout << "LUA_TLIGHTUSERDATA " << buf; + break; + } + + case LUA_TUSERDATA: { + void *p = lua_touserdata( l, i ); + char buf[33]; + snprintf( buf, 32, "void *[%016" PRIxPTR "]", (uintptr_t)p ); + // TODO: is there a tostring entry in the metatable? + cout << "LUA_TUSERDATA " << buf; + break; + } + + case LUA_TTHREAD: { + //lua_State *thread = lua_tothread( l, i ); + // TODO: more information like status of the thread? + cout << "LUA_TTHREAD "; + break; + } default: cout << lua_typename( l, type ) << " <unknown>"; |