summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2014-10-11 21:26:11 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2014-10-11 21:26:11 +0200
commit3ce1734080a7e28ef7385e8c5f22d74631041499 (patch)
treecf238c4658d38e02b7e0b928fe1e76e1d8ede5c0 /src
parentdbb3cae7f15512b04e8a17d4f44fd5b3531a2b51 (diff)
downloadcrawler-3ce1734080a7e28ef7385e8c5f22d74631041499.tar.gz
crawler-3ce1734080a7e28ef7385e8c5f22d74631041499.tar.bz2
playing with some more obscure lua data types
Diffstat (limited to 'src')
-rwxr-xr-xsrc/crawl/crawl.cpp2
-rw-r--r--src/libluaglue/LuaVM.cpp27
2 files changed, 25 insertions, 4 deletions
diff --git a/src/crawl/crawl.cpp b/src/crawl/crawl.cpp
index 3e5239c..4abd37c 100755
--- a/src/crawl/crawl.cpp
+++ b/src/crawl/crawl.cpp
@@ -94,7 +94,7 @@ int main( int /* argc */, char *argv[] )
// go through all type of modules and load them with the proper loader
string modulePath = luaVm.getString( "crawler.module_path" );
bool modulesSearchRecursive = luaVm.getBoolean( "crawler.modules_search_recursive" );
- LOG( logNOTICE ) << "Loading modules from path '" << modulePath << "'"
+ LOG( logNOTICE ) << "Loading modules from path '" << modulePath << "' "
<< ( modulesSearchRecursive ? "(recursive)" : "" );
vector<string> normalizerModules;
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>";