Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void CLuaState::PrintStack(const char *extra)
- {
- Print("\n%s:[", extra);
- int max = lua_gettop(L);
- for (int i = 1; i <= max; i++)
- {
- int type = lua_type(L, i);
- switch(type)
- {
- case LUA_TNONE:
- Print("\t%i: [none]", i);
- break;
- case LUA_TNIL:
- Print("\t%i: [nil]", i);
- break;
- case LUA_TBOOLEAN:
- Print("\t%i: [boolean] %s", i, lua_toboolean(L, i) ? "true" : "false");
- break;
- case LUA_TNUMBER:
- Print("\t%i: [number] %f", i, lua_tonumber(L, i));
- break;
- case LUA_TSTRING:
- Print("\t%i: [string] %s", i, lua_tostring(L, i));
- break;
- default:
- if (type == LUA_TLIGHTUSERDATA || type == LUA_TUSERDATA)
- {
- Print("\t%i: [%s] %p", i, GetMetaTypeName(i), lua_topointer(L, i));
- }
- else
- {
- Print("\t%i: [%s] %p", i, luaL_typename(L, i), lua_topointer(L, i));
- }
- break;
- }
- }
- Print("]%s\n", extra);
- }
Advertisement
Add Comment
Please, Sign In to add comment