JFD
Kathigitarkh
The intention is to pick a random city from this custom table. The rest of the code which does the choosing only ever works for the last city value. So this is evidently not the way to do it :/
The index is always 1. A misunderstanding of the use of tables, perhaps, but I've never added values from a custom table before, and any examples or tutorials that I've come across haven't been much use (although one example does similar to what I'm trying to do, so I don't know). So any help would be appreciated, and much time saving
Code:
for row in GameInfo.Civilization_JFD_ColonialCityNames() do
local civType = row.CivilizationType
if colonialPlayer:GetCivilizationType() == GameInfoTypes[civType] then
local colonialCities = {}
table.insert(colonialCities, row.CityName)
for i, v in ipairs(colonialCities) do
print(i)
print(v)
end
print("random name " .. colonialCities[math.random(#colonialCities)])
The index is always 1. A misunderstanding of the use of tables, perhaps, but I've never added values from a custom table before, and any examples or tutorials that I've come across haven't been much use (although one example does similar to what I'm trying to do, so I don't know). So any help would be appreciated, and much time saving
