I'm trying to go through each mount a player has and add that to a table "flying", "ground" or "aquatic" within the table "mounts". With the code I currently have it, it doesn't add them to a table.
However, if I take out the bit of code to add to ground or aquatic (the elseifs) and have it just add to the flying table it works just fine (and I don't think it's just the flying in particular, but rather I can only add to one sub-table rather than multiple ones).
Is there an error in my code or is it just not possible with this approach?
Lua Code:
local mounts = {}
mounts.flying = {}
mounts.ground = {}
mounts.aquatic = {}
local amount = GetNumCompanions("mount")
local f, g, a = 1
for i = 1, amount do
local creatureID, creatureName, creatureSpellID, icon, issummoned, mountType = GetCompanionInfo("mount",i)
if mountType == 7 or mountType == 15 or mountType == 23 or mountType == 31 then
mounts.flying[f] = {creatureID, creatureName, creatureSpellID, icon, issummoned, mountType}
--print(mounts.flying[f][2])
f = f + 1
elseif mountType == 29 then
mounts.ground[g] = {creatureID, creatureName, creatureSpellID, icon, issummoned, mountType}
--print(mounts.ground[g][2])
g = g + 1
elseif mountType == 12 then
mounts.aquatic[a] = {creatureID, creatureName, creatureSpellID, icon, issummoned, mountType}
--print(mounts.aquatic[a][2])
a = a + 1
end
end