| 276 | //============================================================================// |
| 277 | |
| 278 | void LuaUtils::PrintStack(lua_State* L) { |
| 279 | const int top = lua_gettop(L); |
| 280 | for (int i = 1; i <= top; i++) { |
| 281 | printf("\t%i: type = %s (%p)\n", i, luaL_typename(L, i), lua_topointer(L, i)); |
| 282 | const int type = lua_type(L, i); |
| 283 | if (type == LUA_TSTRING) { |
| 284 | printf("\t\t%s\n", lua_tostring(L, i)); |
| 285 | } |
| 286 | else if (type == LUA_TNUMBER) { |
| 287 | printf("\t\t%f\n", lua_tonumber(L, i)); |
| 288 | } |
| 289 | else if (type == LUA_TBOOLEAN) { |
| 290 | printf("\t\t%s\n", lua_tobool(L, i) ? "true" : "false"); |
| 291 | } |
| 292 | else { |
| 293 | printf("\n"); |
| 294 | } |
| 295 | } |
| 296 | } |
| 297 | |
| 298 | |
| 299 | //============================================================================// |
nothing calls this directly
no test coverage detected