မေႃႇၵျူး:Emoji
Module:Emoji implements two functions:
- emocode
- Takes one unnamed parameter, the name of the emoji, and returns the hex code for the corresponding emoji. If no name is supplied it uses "smiley" as the default (and returns
1f603
). - emoname
- Takes one unnamed parameter, the hex code of the emoji, and returns the name for the corresponding emoji. If no name is supplied it uses "1f603" as the default (and returns
smiley
).
It stores the mapping from name to code in Module:Emoji/data, which internally generates the reverse lookup table from code to name.
တူဝ်ယၢင်ႇ
မႄးထတ်း{{#invoke:Emoji | emocode | wink}}
→1f609
{{#invoke:Emoji | emocode | grin}}
→1f601
{{#invoke:Emoji | emocode | 8ball}}
→1f3b1
{{#invoke:Emoji | emocode }}
→1f603
{{#invoke:Emoji | emoname | 1f62b}}
→tired_face
{{#invoke:Emoji | emoname }}
→smiley
ၽိုၼ်ၵႅမ်မိုဝ်းလၢႆးၸႂ်ႉတိုဝ်း (documentation)တီႈၽၢႆႇၼိူဝ်ၼႆႉ လုၵ်ႉတီႈ မေႃႇၵျူး:Emoji/doc သေ ၶၢႆႉသႂ်ႇၶဝ်ႈ (ႁဵတ်း transclude ဝႆႉၶႃႈဢေႃႈ။ (မႄးထတ်း | ပိုၼ်း) ၽူႈၸိူဝ်းမႄးထတ်းၶဝ် ၸၢင်ႈၸၢမ်းတူၺ်းလႆႈ ၸိူဝ်းပဵၼ်ၼႃႈလိၵ်ႈ sandbox (သၢင်ႈ | ငဝ်းမိူၼ်) လႄႈ testcases (သၢင်ႈ) ႁင်း မေႃႇၵျူးဢၼ်ၼႆႉ လႆႈယူႇၶႃႈ။ ၼႃႈလိၵ်ႈၽႄ ႁင်း မေႃႇၵျူး ဢၼ်ၼႆႉ။. |
local p= {}
function p.emocode(frame)
local emotbl = mw.loadData ('Module:Emoji/data').emotbl
local emoname = mw.text.trim(frame.args[1] or "") -- make sure empty and missing parameters both become the empty string
if '' == emoname then emoname = 'smiley' end -- use default value of 'smiley' if parameter is empty or missing
return emotbl[emoname] or emoname
end
function p.emoname(frame)
local emorevtbl = mw.loadData('Module:Emoji/data/revtable')['emorevtbl']
local emocode = mw.text.trim(frame.args[1] or "") -- make sure empty and missing parameters both become the empty string
if '' == emocode then emocode = '1f603' end -- use default value of '1f603' if parameter is empty or missing
return emorevtbl[emocode] or emocode
end
return p