| 322 | |
| 323 | //********************************************************************************************* |
| 324 | void CScriptEngine::dump_state() |
| 325 | { |
| 326 | static bool reentrantGuard = false; |
| 327 | if (reentrantGuard) |
| 328 | return; |
| 329 | reentrantGuard = true; |
| 330 | |
| 331 | lua_State* L = lua(); |
| 332 | lua_Debug l_tDebugInfo; |
| 333 | for (int i = 0; lua_getstack(L, i, &l_tDebugInfo); ++i) |
| 334 | { |
| 335 | lua_getinfo(L, "nSlu", &l_tDebugInfo); |
| 336 | |
| 337 | if (!xr_strcmp(l_tDebugInfo.what, "C")) |
| 338 | { |
| 339 | Msg("%2d : [C ] %s", i, l_tDebugInfo.name ? l_tDebugInfo.name : ""); |
| 340 | } |
| 341 | else |
| 342 | { |
| 343 | string_path temp; |
| 344 | if (l_tDebugInfo.name) |
| 345 | xr_sprintf(temp, "%s(%d)", l_tDebugInfo.name, l_tDebugInfo.linedefined); |
| 346 | else |
| 347 | xr_sprintf(temp, "function <%s:%d>", l_tDebugInfo.short_src, l_tDebugInfo.linedefined); |
| 348 | |
| 349 | Msg("%2d : [%3s] %s(%d) : %s", i, l_tDebugInfo.what, l_tDebugInfo.short_src, l_tDebugInfo.currentline, temp); |
| 350 | } |
| 351 | |
| 352 | Msg("\tLocals:"); |
| 353 | const char* name; |
| 354 | int VarID = 1; |
| 355 | while ((name = lua_getlocal(L, &l_tDebugInfo, VarID++)) != NULL) |
| 356 | { |
| 357 | LogVariable(L, name, 1); |
| 358 | |
| 359 | lua_pop(L, 1); /* remove variable value */ |
| 360 | } |
| 361 | m_dumpedObjList.clear(); |
| 362 | Msg("\tEnd"); |
| 363 | } |
| 364 | reentrantGuard = false; |
| 365 | } |
| 366 | |
| 367 | void CScriptEngine::LogTable(lua_State* l, LPCSTR S, int level) |
| 368 | { |
no test coverage detected