File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -616,23 +616,26 @@ int LuaUnsyncedRead::GetProfilerTimeRecord(lua_State* L)
616616{
617617 const CTimeProfiler::TimeRecord& record = CTimeProfiler::GetInstance ().GetTimeRecord (lua_tostring (L, 1 ));
618618
619- int numRet = 5 ;
619+ const bool wantFrameData = luaL_optboolean (L, 2 , false );
620+
620621 lua_pushnumber (L, record.total .toMilliSecsf ());
621622 lua_pushnumber (L, record.current .toMilliSecsf ());
622623 lua_pushnumber (L, record.stats .x ); // max-dt
623624 lua_pushnumber (L, record.stats .y ); // time-%
624625 lua_pushnumber (L, record.stats .z ); // peak-%
625626
626- if (luaL_optboolean (L, 2 , false )) {
627- for (size_t i = 0 ; i < record.frames .size (); i++) {
628- lua_pushnumber (L, i + 1 ); // key
629- lua_pushnumber (L, record.frames [i].toMilliSecsf ()); // val
630- lua_rawset (L, -3 );
631- }
632- ++numRet;
627+ if (!wantFrameData)
628+ return 5 ;
629+
630+ lua_createtable (L, record.frames .size (), 0 );
631+
632+ for (size_t i = 0 ; i < record.frames .size (); i++) {
633+ lua_pushnumber (L, i + 1 ); // key
634+ lua_pushnumber (L, record.frames [i].toMilliSecsf ()); // val
635+ lua_rawset (L, -3 );
633636 }
634637
635- return numRet ;
638+ return 6 ;
636639}
637640
638641/* **
You can’t perform that action at this time.
0 commit comments