Module:HeroDataArrays: Difference between revisions

Jump to navigation Jump to search
more dash stats
added hero sorting function
Line 14: Line 14:
         end
         end
     end
     end
end
-- Use sort name for edge cases like "The Doorman"
local function sortHeroes(rows)
    local function getSortName(name)
        return (name:gsub("^The ", ""))
    end
    table.sort(rows, function(a, b)
        local nameA = getSortName(a.name or "")
        local nameB = getSortName(b.name or "")
        return nameA:lower() < nameB:lower()
    end)
end
end


Line 130: Line 143:
         })
         })
     end
     end
     table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end)
     sortHeroes(rows)


     local tableDefs = {
     local tableDefs = {
Line 165: Line 178:
         })
         })
     end
     end
     table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end)
     sortHeroes(rows)


     local tableDefs = {
     local tableDefs = {
Line 211: Line 224:
         })
         })
     end
     end
     table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end)
     sortHeroes(rows)


     local tableDefs = {
     local tableDefs = {
Line 265: Line 278:
     end
     end


     table.sort(rows, function(a, b)
     sortHeroes(rows)
        return a.name:lower() < b.name:lower()
    end)


     local tableDefs = {
     local tableDefs = {
Line 310: Line 321:
     end
     end
   
   
     table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end)
     sortHeroes(rows)


     local tableDefs = {
     local tableDefs = {
Line 353: Line 364:
         })
         })
     end
     end
     table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end)
     sortHeroes(rows)


     local tableDefs = {
     local tableDefs = {
Line 398: Line 409:
         })
         })
     end
     end
     table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end)
     sortHeroes(rows)


     local tableDefs = {
     local tableDefs = {
Line 447: Line 458:
         })
         })
     end
     end
     table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end)
     sortHeroes(rows)


     local tableDefs = {
     local tableDefs = {
Line 485: Line 496:
         })
         })
     end
     end
     table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end)
     sortHeroes(rows)


     local tableDefs = {
     local tableDefs = {
Line 523: Line 534:
         })
         })
     end
     end
     table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end)
     sortHeroes(rows)


     local tableDefs = {
     local tableDefs = {
Line 559: Line 570:
         })
         })
     end
     end
     table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end)
     sortHeroes(rows)


     local tableDefs = {
     local tableDefs = {
Line 595: Line 606:
         })
         })
     end
     end
     table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end)
     sortHeroes(rows)
      
      
     local tableDefs = {
     local tableDefs = {
Line 631: Line 642:
     end
     end


     table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end)
     sortHeroes(rows)


     local tableDefs = {
     local tableDefs = {
Line 663: Line 674:
         })
         })
     end
     end
     table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end)
     sortHeroes(rows)


     local tableDefs = {
     local tableDefs = {
Line 699: Line 710:
         })
         })
     end
     end
     table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end)
     sortHeroes(rows)


     local tableDefs = {
     local tableDefs = {
Line 746: Line 757:
         })
         })
     end
     end
     table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end)
     sortHeroes(rows)


     local tableDefs = {
     local tableDefs = {
Line 802: Line 813:
         })
         })
     end
     end
     table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end)
     sortHeroes(rows)


     local tableDefs = {
     local tableDefs = {
Line 835: Line 846:
         })
         })
     end
     end
     table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end)
     sortHeroes(rows)


     local tableDefs = {
     local tableDefs = {