Module:GetEmoji

From Heterodontosaurus Balls
Revision as of 19:20, 9 July 2026 by Heterodontosaurus (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:GetEmoji/doc

--[[
This module makes icons using {{I}} display 🟢 when copied as text.

]]

local p = {}

local codes = {
}

function p.code( frame )
    c = mw.text.trim(frame.args[1])
    for i, a in ipairs(codes) do
        if a[1] == c then
            if frame.args[2] == "alt" then
                -- Return alt text if specified
                if a[2] then
                    return a[2]
                else
                    return "(Icon)" -- If no alt text is specified, return "(Icon)"
                end
            else
                -- Return the link destination (if available)
                return a[3] or c -- If no link destination, return the code itself
            end
        end
    end
    -- If code is not found, return "🟢" as the fallback
    return "🟢"
end

return p