diff --git a/ag.cc b/ag.cc index a0fadd4..53975af 100644 --- a/ag.cc +++ b/ag.cc @@ -21,11 +21,13 @@ namespace ag switch (type) { case LUA_TNUMBER: + cout << lua_tonumber(L, index); + break; case LUA_TSTRING: cout << lua_tostring(L, index); break; case LUA_TTABLE: - cout << '['; + cout << "{ "; /* traverse the table and print the keys/values */ lua_checkstack(L, 3); @@ -34,13 +36,15 @@ namespace ag { if (!first) cout << ", "; - ag_print_val(L, -2); + cout << '['; + ag_print_val(L, index + 1); + cout << ']'; cout << " => "; - ag_print_val(L, -1); + ag_print_val(L, index + 2); lua_pop(L, 1); } - cout << ']'; + cout << " }"; break; case LUA_TFUNCTION: cout << "";