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

Method Clone

CryScriptSystem/ScriptObject.cpp:947–974  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

945}
946
947bool CScriptObject::Clone(IScriptObject *pObj)
948{
949 //BEGIN_CHECK_STACK
950 _GUARD_STACK(m_pLS);
951 int top = lua_gettop(m_pLS);
952
953 if (!lua_xgetref(m_pLS, pObj->GetRef()))
954 return false;
955 if (!_GET_THIS())
956 return false;
957
958 int srcTable = top + 1;
959 int trgTable = top + 2;
960
961 lua_pushnil(m_pLS); // first key
962 while (lua_next(m_pLS, srcTable) != 0)
963 {
964 // `key' is at index -2 and `value' at index -1
965 lua_pushvalue(m_pLS, - 2); // Push again index.
966 lua_pushvalue(m_pLS, - 2); // Push value.
967 SET_FUNCTION(m_pLS, trgTable);
968 lua_pop(m_pLS, 1); // pop value, leave index.
969 }
970 //lua_settop(m_pLS, top); // Restore stack.
971 //END_CHECK_STACK
972
973 return true;
974}
975
976
977

Callers 9

InitGlobalMethod · 0.45
SetEntityMethod · 0.45
GetValueRecursiveMethod · 0.45
CreateObjectFromTableMethod · 0.45
CreateScreenFromTableMethod · 0.45
CreateMethod · 0.45
SetWeaponFireParamsMethod · 0.45
CTableCloneMethod · 0.45
OnElementFoundMethod · 0.45

Calls 6

lua_gettopFunction · 0.85
lua_xgetrefFunction · 0.85
lua_pushnilFunction · 0.85
lua_nextFunction · 0.85
lua_pushvalueFunction · 0.85
GetRefMethod · 0.80

Tested by

no test coverage detected