Module:Monsters: Difference between revisions

m
getSlayerTierMonsterTable: Adjust input validation
(Implement getSlayerTierMonsterTable; Improve performance of getMonster, getSpecialAttack, getPassive)
m (getSlayerTierMonsterTable: Adjust input validation)
Line 893: Line 893:
   if tier == nil then
   if tier == nil then
     return "ERROR: No tier specified"
     return "ERROR: No tier specified"
   elseif type(tier) ~= "number" then
   elseif tonumber(tier) == nil then
     return "ERROR: Tier must be an integer"
     return "ERROR: Tier must be an integer"
   else
   else
     tier = math.floor(tier)
     tier = math.floor(tonumber(tier))
     local tierCount = Shared.tableCount(SlayerTiers) - 1
     local tierCount = Shared.tableCount(SlayerTiers) - 1
     if tier < 0 or tier > tierCount then
     if tier < 0 or tier > tierCount then