25 #define LOG_LUA LOG_STREAM(info, log_scripting_lua)
28 static void value_to_stringstream(
32 const bool verbose_table =
true)
34 const int t = lua_type(L,
i);
37 output <<
"STRING; VALUE: " << lua_tostring(L,
i);
40 output <<
"BOOLEAN; VALUE: " << (lua_toboolean(L,
i) ?
"true" :
"false");
43 output <<
"NUMBER; VALUE: " << lua_tonumber(L,
i);
46 output <<
"NIL; VALUE: nil";
50 output <<
"TABLE; VALUE: " << lua_topointer(L,
i);
54 unsigned keyindex = lua_gettop(L) + 1;
56 while(lua_next(L,
i) != 0)
59 const int keytype = lua_type(L, keyindex);
62 output << lua_tostring(L, keyindex);
65 output << (lua_toboolean(L, keyindex) ?
"true" :
"false");
68 output << lua_tonumber(L, keyindex);
71 output << lua_topointer(L, keyindex);
82 output <<
"USERDATA; VALUE: " << lua_topointer(L,
i);
85 output <<
"FUNCTION; VALUE: " << lua_topointer(L,
i);
88 output <<
"THREAD; VALUE: " << lua_topointer(L,
i);
90 case LUA_TLIGHTUSERDATA:
91 output <<
"LIGHTUSERDATA; VALUE: " << lua_topointer(L,
i);
100 void ds(lua_State *L,
const bool verbose_table) {
103 int top = lua_gettop(L);
104 for (
int i = 1;
i <= top; ++
i) {
105 output <<
"INDEX: " <<
i <<
"; TYPE: ";
106 value_to_stringstream(
output,
i, L,
"", verbose_table);
static std::ostream & output()
static lg::log_domain log_scripting_lua("scripting/lua")