Module:HeroDataArrays: Difference between revisionsGive feedback
Gammaton32 (talk | contribs) more dash stats |
Gammaton32 (talk | contribs) 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 | ||
sortHeroes(rows) | |||
local tableDefs = { | local tableDefs = { | ||
| Line 165: | Line 178: | ||
}) | }) | ||
end | end | ||
sortHeroes(rows) | |||
local tableDefs = { | local tableDefs = { | ||
| Line 211: | Line 224: | ||
}) | }) | ||
end | end | ||
sortHeroes(rows) | |||
local tableDefs = { | local tableDefs = { | ||
| Line 265: | Line 278: | ||
end | end | ||
sortHeroes(rows) | |||
local tableDefs = { | local tableDefs = { | ||
| Line 310: | Line 321: | ||
end | end | ||
sortHeroes(rows) | |||
local tableDefs = { | local tableDefs = { | ||
| Line 353: | Line 364: | ||
}) | }) | ||
end | end | ||
sortHeroes(rows) | |||
local tableDefs = { | local tableDefs = { | ||
| Line 398: | Line 409: | ||
}) | }) | ||
end | end | ||
sortHeroes(rows) | |||
local tableDefs = { | local tableDefs = { | ||
| Line 447: | Line 458: | ||
}) | }) | ||
end | end | ||
sortHeroes(rows) | |||
local tableDefs = { | local tableDefs = { | ||
| Line 485: | Line 496: | ||
}) | }) | ||
end | end | ||
sortHeroes(rows) | |||
local tableDefs = { | local tableDefs = { | ||
| Line 523: | Line 534: | ||
}) | }) | ||
end | end | ||
sortHeroes(rows) | |||
local tableDefs = { | local tableDefs = { | ||
| Line 559: | Line 570: | ||
}) | }) | ||
end | end | ||
sortHeroes(rows) | |||
local tableDefs = { | local tableDefs = { | ||
| Line 595: | Line 606: | ||
}) | }) | ||
end | end | ||
sortHeroes(rows) | |||
local tableDefs = { | local tableDefs = { | ||
| Line 631: | Line 642: | ||
end | end | ||
sortHeroes(rows) | |||
local tableDefs = { | local tableDefs = { | ||
| Line 663: | Line 674: | ||
}) | }) | ||
end | end | ||
sortHeroes(rows) | |||
local tableDefs = { | local tableDefs = { | ||
| Line 699: | Line 710: | ||
}) | }) | ||
end | end | ||
sortHeroes(rows) | |||
local tableDefs = { | local tableDefs = { | ||
| Line 746: | Line 757: | ||
}) | }) | ||
end | end | ||
sortHeroes(rows) | |||
local tableDefs = { | local tableDefs = { | ||
| Line 802: | Line 813: | ||
}) | }) | ||
end | end | ||
sortHeroes(rows) | |||
local tableDefs = { | local tableDefs = { | ||
| Line 835: | Line 846: | ||
}) | }) | ||
end | end | ||
sortHeroes(rows) | |||
local tableDefs = { | local tableDefs = { | ||