Module:Chat options

-- local p = {}

local hasc = require('Module:Paramtest').has_content function p.main(frame) local args = frame:getParent.args local items = {} local i = 1 while hasc(args[i]) do		local item = mw.text.trim(args[i]) local key local tooltip if item:lower == 'accept' then key = '&#x2713;' tooltip = '[Accept Quest]' elseif item:lower == 'any' or item == '#' or item == '~' then key = '~' tooltip = '[Any option]' else key = item:match('^([%d%w])') if key then tooltip = mw.text.trim(mw.ustring.sub(item, 2)) end end table.insert(items, { key, tooltip }) i = i + 1 end return p._main(items) end

function p._main(items) local element = mw.html.create('span') element:addClass('chat-options') :wikitext('( ')	local k,t,kspan	local keys = {}	for i,v in ipairs(items) do		k = mw.text.trim(v[1])		t = mw.text.trim(v[2])		kspan = mw.html.create('span')		kspan:wikitext(k)		if not is_empty(t) then			kspan	:addClass('chat-options-underline')					:attr('title', t)		end		table.insert(keys, tostring(kspan))	end	element:wikitext(table.concat(keys, '&bull;')):wikitext(')') return tostring(element) end

function is_empty(s) return s == nil or s == '' end

return p