Module:HeroData: Difference between revisions

Jump to navigation Jump to search
Undo revision 27547 by Gammaton32 (talk) oops
Tag: Undo
added hero tag function
Line 661: Line 661:
end
end
return result
return result
end
-- Mapping from hero name to internal tag name
local TAG_NAME_MAP = {
    ["Holliday"] = "Astro",
}
-- Function to call hero tags based on name
p.get_hero_tag = function (frame)
    local input_name = frame.args[1]
    local input_number = tonumber(frame.args[2])
    -- Validate input
    if not input_name then
        return "Error: Missing name input."
    end
    if input_number ~= 1 and input_number ~= 2 and input_number ~= 3 then
        return string.format("Error: Invalid number '%s'. Must be 1, 2, or 3.", tostring(frame.args[2]))
    end
    local tagname = TAG_NAME_MAP[input_name]
    if not tagname then
        return string.format("Error: Unknown name '%s'.", input_name)
    end
    -- Build localization key
    local key = string.format("Citadel_%s_HeroTag_%d", tagname, input_number)
    -- Call Lang.get_string
    local result = Lang.get_string(key)
    return result or ("[Missing string for key: " .. key .. "]")
end
end


return p
return p