Jump to content

Module:Emoji

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Trappist the monk (talk | contribs) at 10:26, 24 March 2019 (moved data table to Module:Emoji/data where it belongs;). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local p= {}
local emotbl = mw.loadData ('Module:Emoji/data');

function p.emocode(frame)
	local emoname = mw.text.trim(frame.args[1] or "smiley")
	return emotbl[emoname] or emoname
end

function p.emoname(frame)
	local emocode = mw.text.trim(frame.args[1] or "1f603")
	local match
	for k, v in pairs(emotbl) do
		if v == emocode then
			match = k
			break
		end
	end
	return match or emocode
end

return p