Module:HeroData: Difference between revisionsGive feedback
Jump to navigation
Jump to search
Gammaton32 (talk | contribs) completed hero tags list |
Gammaton32 (talk | contribs) simplified get_hero_tag parameters |
||
| Line 701: | Line 701: | ||
-- Function to call hero tags based on name | -- Function to call hero tags based on name | ||
p.get_hero_tag = function (frame) | p.get_hero_tag = function (frame) | ||
local | local name = frame.args[1] | ||
local | local number = tonumber(frame.args[2]) | ||
-- Validate input | -- Validate input | ||
if not | if not name then | ||
return "Error: Missing name input." | return "Error: Missing name input." | ||
end | end | ||
if | if number ~= 1 and number ~= 2 and number ~= 3 then | ||
return string.format("Error: Invalid number '%s'. Must be 1, 2, or 3.", tostring(frame.args[2])) | return string.format("Error: Invalid number '%s'. Must be 1, 2, or 3.", tostring(frame.args[2])) | ||
end | end | ||
local tagname = TAG_NAME_MAP[ | local tagname = TAG_NAME_MAP[name] | ||
if not tagname then | if not tagname then | ||
return string.format("Error: Unknown name '%s'.", | return string.format("Error: Unknown name '%s'.", name) | ||
end | end | ||
-- Build localization key | -- Build localization key | ||
local key = string.format("Citadel_%s_HeroTag_%d", tagname, | local key = string.format("Citadel_%s_HeroTag_%d", tagname, number) | ||
-- Call Lang.get_string | -- Call Lang.get_string | ||