First thing that pops up for me is the line:
Is it possible that what you meant to write is
?
[Edit]
It really looks like lines 18, 20, 22 and 24 should complain about indexing/ arithmetic with nil values. Do you get these errors?
Anyway instead of managing indexes you can just use:
Lua Code:
table.insert (mounts.flying, {creatureID, creatureName, creatureSpellID, icon, issummoned, mountType})