More actions
m concat card to ret earlier |
m now sorts the heroes alphabetically |
||
Line 10: | Line 10: | ||
end | end | ||
local | local heroes = {} | ||
for hero_key, hero_data in pairs(heroes_data) do | for hero_key, hero_data in pairs(heroes_data) do | ||
local card | local card = '' | ||
if hero_data["Name"] ~= nil and hero_data["IsDisabled"] == false then | if hero_data["Name"] ~= nil and hero_data["IsDisabled"] == false then | ||
if (hero_data["InDevelopment"] == false and current_or_upcoming == 'Current' or hero_data["InDevelopment"] == true and current_or_upcoming == 'Upcoming') then | if (hero_data["InDevelopment"] == false and current_or_upcoming == 'Current' or hero_data["InDevelopment"] == true and current_or_upcoming == 'Upcoming') then | ||
table.insert(heroes, lang_module.get_string(hero_key)) | |||
end | end | ||
end | end | ||
end | end | ||
--Order list alphabetically | |||
table.sort(heroes) --O(nlogn) | |||
--Add each item to output | |||
local ret = '' | |||
for index, hero_name in ipairs(heroes) do | |||
ret = ret .. '{{Hero Card Nav|Hero=' .. hero_name .. '}} ' | |||
end | |||
--Remove the last space | |||
ret = string.sub(ret, 1, -(string.len(' '))-1) | |||
return frame:preprocess(ret) | return frame:preprocess(ret) | ||
end | end | ||
return p | return p |