Code
9152#if defined(MOD_API_LUA_EXTENSIONS) && defined(MOD_API_PLAYER_LOGS)9153int CvLuaPlayer::lGetDiplomacyLog(lua_State* L)9154{9155 CvPlayerAI* pkPlayer = GetInstance(L);91569157 lua_createtable(L, 0, 0);9158 int index = 1;91599160 CvEventLog* pDiplomacyLog = pkPlayer->GetDiplomacyLog();9161 for (int i = 0; i < pDiplomacyLog->GetNumEvents(); i++)9162 {9163 lua_createtable(L, 0, 0);9164 const int t = lua_gettop(L);91659166 lua_pushinteger(L, pDiplomacyLog->GetTurn(i));9167 lua_setfield(L, t, "Turn");9168 lua_pushstring(L, pDiplomacyLog->GetMessage(i));9169 lua_setfield(L, t, "Message");9170 lua_pushinteger(L, pDiplomacyLog->GetOtherPlayer(i));9171 lua_setfield(L, t, "OtherPlayer");9172 lua_pushinteger(L, pDiplomacyLog->GetData1(i));9173 lua_setfield(L, t, "Data1");9174 lua_pushinteger(L, pDiplomacyLog->GetData2(i));9175 lua_setfield(L, t, "Data2");9176 lua_pushinteger(L, pDiplomacyLog->GetData3(i));9177 lua_setfield(L, t, "Data3");9178 lua_pushinteger(L, pDiplomacyLog->GetData4(i));9179 lua_setfield(L, t, "Data4");91809181 lua_rawseti(L, -2, index++);9182 }91839184 return 1;9185}