Module:HeroData/nav: Difference between revisionsGive feedback
Refactored for performance optimization |
Gammaton32 (talk | contribs) fix localized templates by calling for hero link instead of hero name |
||
| Line 125: | Line 125: | ||
for _, hero in ipairs(heroes) do | for _, hero in ipairs(heroes) do | ||
-- Lua optimization: clean ternary fallback for page_title assignment | -- Lua optimization: clean ternary fallback for page_title assignment | ||
local page_title = subpage and (hero. | local page_title = subpage and (hero.link .. '/' .. subpage) or hero.name | ||
-- Skip redlinks entirely when enabled | -- Skip redlinks entirely when enabled | ||
| Line 131: | Line 131: | ||
local item | local item | ||
if subpage then | if subpage then | ||
item = string.format('{{PageRef|%s|alt_link=%s}}', hero. | item = string.format('{{PageRef|%s|alt_link=%s}}', hero.link, page_title) | ||
else | else | ||
item = string.format('{{HeroIcon|%s}}', hero. | item = string.format('{{HeroIcon|%s}}', hero.link) | ||
end | end | ||
table.insert(parts, item) | table.insert(parts, item) | ||
| Line 159: | Line 159: | ||
for _, hero in ipairs(heroes) do | for _, hero in ipairs(heroes) do | ||
table.insert(parts, string.format('File:%s%s|%s%s\n', hero. | table.insert(parts, string.format('File:%s%s|%s%s\n', hero.link, file_name, hero.name, description)) | ||
end | end | ||