Jump to content

Module:Emoji: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
No edit summary
make defaults obvious
Line 6: Line 6:
local emoname = frame.args[1] and mw.text.trim(frame.args[1])
local emoname = frame.args[1] and mw.text.trim(frame.args[1])
if '' == emoname then
if '' == emoname then
emoname = 'smiley';
local name_default = 'smiley'
emoname = name_default;
end
end
return emotbl[emoname] or emoname
return emotbl[emoname] or emoname
Line 15: Line 16:
local emocode = frame.args[1] and mw.text.trim(frame.args[1])
local emocode = frame.args[1] and mw.text.trim(frame.args[1])
if '' == emocode then
if '' == emocode then
emocode = '1f603';
local code_default = '1f603'
emocode = code_default;
end
end
return emorevtbl[emocode] or emocode
return emorevtbl[emocode] or emocode

Revision as of 14:05, 25 March 2019

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

function p.emocode(frame)
	local emotbl = emodata.emotbl
	local emoname = frame.args[1] and mw.text.trim(frame.args[1])
	if '' == emoname then
		local name_default = 'smiley'
		emoname = name_default;
	end
	return emotbl[emoname] or emoname
end

function p.emoname(frame)
	local emorevtbl = emodata.emorevtbl
	local emocode = frame.args[1] and mw.text.trim(frame.args[1])
	if '' == emocode then
		local code_default = '1f603'
		emocode = code_default;
	end
	return emorevtbl[emocode] or emocode
end

return p