MCPcopy Create free account
hub / github.com/MergHQ/CRYENGINE / Dump

Method Dump

Code/CryEngine/CryScriptSystem/ScriptTable.cpp:420–513  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

418}
419
420void CScriptTable::Dump(IScriptTableDumpSink* p)
421{
422 if (!p) return;
423 CHECK_STACK(L);
424 int top = lua_gettop(L);
425
426 PushRef();
427
428 int trgTable = top + 1;
429
430 lua_pushnil(L); // first key
431 int reftop = lua_gettop(L);
432 while (lua_next(L, trgTable) != 0)
433 {
434 // `key' is at index -2 and `value' at index -1
435 if (lua_type(L, -2) == LUA_TSTRING)
436 {
437 const char* sName = lua_tostring(L, -2); // again index
438 switch (lua_type(L, -1))
439 {
440 case LUA_TNIL:
441 p->OnElementFound(sName, svtNull);
442 break;
443 case LUA_TBOOLEAN:
444 p->OnElementFound(sName, svtBool);
445 break;
446 case LUA_TLIGHTUSERDATA:
447 p->OnElementFound(sName, svtPointer);
448 break;
449 case LUA_TNUMBER:
450 p->OnElementFound(sName, svtNumber);
451 break;
452 case LUA_TSTRING:
453 p->OnElementFound(sName, svtString);
454 break;
455 case LUA_TTABLE:
456 if (strcmp(sName, "__index") != 0)
457 p->OnElementFound(sName, svtObject);
458 break;
459 case LUA_TFUNCTION:
460 p->OnElementFound(sName, svtFunction);
461 break;
462 case LUA_TUSERDATA:
463 p->OnElementFound(sName, svtUserData);
464 break;
465 }
466 ;
467 }
468 else
469 {
470 int nIdx = (int)lua_tonumber(L, -2); // again index
471 switch (lua_type(L, -1))
472 {
473 case LUA_TNIL:
474 p->OnElementFound(nIdx, svtNull);
475 break;
476 case LUA_TBOOLEAN:
477 p->OnElementFound(nIdx, svtBool);

Callers 3

ShowSelfMethod · 0.45
ShowLocalsForFrameMethod · 0.45
OnElementFoundMethod · 0.45

Calls 3

strcmpFunction · 0.85
IterTableFunction · 0.85
OnElementFoundMethod · 0.45

Tested by

no test coverage detected