MCPcopy Create free account
hub / github.com/StrongPC123/Far-Cry-1-Source-Full / Count

Method Count

CryScriptSystem/ScriptObject.cpp:638–658  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

636}
637
638int CScriptObject::Count()
639{
640 _GUARD_STACK(m_pLS);
641 int top = lua_gettop(m_pLS);
642
643 int nCount=0;
644 if (!_GET_THIS())
645 return -1;
646
647 int trgTable = top + 1;
648
649 lua_pushnil(m_pLS); // first key
650 while (lua_next(m_pLS, trgTable) != 0)
651 {
652 // `key' is at index -2 and `value' at index -1
653 nCount++;
654 lua_pop(m_pLS, 1); // pop value, leave index.
655 }
656 //lua_settop(m_pLS, top); // Restore stack.
657 return nCount;
658}
659
660bool CScriptObject::GetAt(int nIdx, int &nVal)
661{

Callers 3

EnumDisplayFormatsMethod · 0.45
GetStackAndLocalsMethod · 0.45
OnPaintMethod · 0.45

Calls 3

lua_gettopFunction · 0.85
lua_pushnilFunction · 0.85
lua_nextFunction · 0.85

Tested by

no test coverage detected