Módulo:Infobox Roubo
Documentação do módulo
Esta documentação é transcluída de Predefinição:Sem documentação/doc. [editar] [atualizar]
Este módulo não possui nenhuma documentação. Por favor, considere adicionar uma documentação em Módulo:Infobox Roubo/doc. [editar]
Módulo:Infobox Roubo requer Módulo:Switchfobox multi.
Módulo:Infobox Roubo requer Módulo:Yesno.
local p = {}
local yesno = require('Módulo:Yesno')
local ns = mw.title.getCurrentTitle().nsText
local pgTitle = mw.title.getCurrentTitle().text
local _thvimg = '[[Arquivo:Roubo ícone.png|link=Roubo|frameless|20px]]'
local _aglimg = '[[Arquivo:Agilidade ícone.png|link=Agilidade|frameless|20px]]'
local switchfo = require('Módulo:Switchfobox multi')
-- Params list for Switchfobox
local infobox_params = {
'versão',
'nível',
'exp',
'reaparecimento',
'saque múltiplo',
'atordoamento',
'dano',
'guardas',
'saque',
'nome',
'imagem',
'localização',
'missão',
'nosmw'
}
-- Used to determine single or multi boxes
function p.main(frame)
local args = frame:getParent().args
local ret_module
if args['versão1'] then
--has multiple
return switchfo.make_boxes( args, infobox_params, 'Infobox Roubo único' )
else
--single
return p.single(frame)
end
end
-- Creates a single infobox
function p.single(frame)
local args = frame:getParent().args
local multiloot = yesno(args['saque multíplo']) or false
local lvl = numberargs(args['nível'],'nível') or 'Desconhecido'
local lvl_disp = lvl..' '.._thvimg
local xp = numberargs(args['exp'], 'exp') or 'Desconhecido'
local xp_disp = xp..' EXP'
local respawn = numberargs(args.reaparecimento, 'reaparecimento')
local respawn_disp = timearg(respawn, 'reaparecimento')
local stun = numberargs(args.atordoamento, 'atordoamento')
local damage = stringargs(args.dano, 'dano')
local stun_disp = timearg(stun, 'atordoamento')..' / '..damage
local loot = args.saque or '[[#|? (editar)|action=edit]]'
-- For generated versions
local name = args.nome
local image = stringargs(args.imagem, 'imagem')
local location = stringargs(args['localização'], 'localização')
local quest = stringargs(args['missão'], 'missão')
-- Version (for smw subobject)
local version = args['versão']
local dbloot, tploot, qdloot
if multiloot then
dbloot = lootlvl(lvl, 10)
trloot = lootlvl(lvl, 20)
qdloot = lootlvl(lvl, 30)
end
local guardasTbl, guardas = {}
if type(args.guardas_tabela) == 'table' then
guardasTbl = args.guardas_tabela
guardas = mw.text.listToText(guardasTbl, ', ', ', ')
elseif args.guardas then
for v in args.guardas:gmatch('([^,]+)') do
v = '[['..v..']]'
table.insert(guardasTbl, v)
end
guardas = mw.text.listToText(guardasTbl, ', ', ', ')
end
if string.match(loot, '<tr class="nonmembers%-item"') or string.match(loot, '<tr class="members%-item"') then
local dropHead = mw.getCurrentFrame():expandTemplate{title='ObjetoLargadoCabeçalho'}
local dropFoot = mw.getCurrentFrame():expandTemplate{title='ObjetoLargadoRodapé'}
loot = dropHead..loot..dropFoot
end
local t = mw.html.create('table')
if not name then
t:addClass('wikitable infobox-thieving')
:css('text-align','center')
if respawn then
t:tag('tr')
:tag('th'):wikitext('Nível de Roubo'):done()
:tag('td'):wikitext(lvl_disp):done()
:tag('th'):wikitext('EXP em Roubo'):done()
:tag('td'):wikitext(xp_disp):done()
:tag('th'):wikitext('Tempo de reaparecimento'):done()
:tag('td'):wikitext(respawn_disp):done()
:done()
elseif stun then
t:tag('tr')
:tag('th'):wikitext('Nível de Roubo'):done()
:tag('td'):wikitext(lvl_disp):done()
:tag('th'):wikitext('EXP em Roubo'):done()
:tag('td'):wikitext(xp_disp):done()
:tag('th'):wikitext('Tempo de atordoamento / dano'):done()
:tag('td'):wikitext(stun_disp):done()
:done()
else
t:tag('tr')
:tag('th'):wikitext('Nível de Roubo'):done()
:tag('td'):wikitext(lvl_disp):done()
:tag('th'):wikitext('EXP em Roubo'):done()
:tag('td'):wikitext(xp_disp):done()
:tag('td'):attr('colspan',2):wikitext('<span title="Insira o tempo de atordoamento e dano ou tempo de reaparecimento" style="color:red; font-weight:bold; cursor:help; border-bottom:1px dotted red;">ERROR</span>'):done()
:done()
end
if multiloot then
t:tag('tr')
:tag('th'):wikitext('Saque duplo'):done()
:tag('td'):wikitext(dbloot):done()
:tag('th'):wikitext('Saque triplo'):done()
:tag('td'):wikitext(trloot):done()
:tag('th'):wikitext('Saque quadrúplo'):done()
:tag('td'):wikitext(qdloot):done()
:done()
end
if guards then
t:tag('tr')
:tag('th'):wikitext('Guardado por'):done()
:tag('td'):attr('colspan',5):wikitext(guards):done()
:done()
end
t:tag('tr')
:tag('th'):attr('colspan',6):wikitext('Saque'):done()
:done()
:tag('tr')
:tag('td'):attr('colspan',6):addClass('thvloot-cell'):wikitext(loot):done()
:done()
-- Version with name, location etc
else
t:addClass('wikitable')
:css('text-align','center')
if multiloot and respawn and guards then
t:tag('tr')
:tag('th'):wikitext(name):done()
:tag('th'):wikitext('Nível de Roubo'):done()
:tag('th'):wikitext('Saque duplo'):done()
:tag('th'):wikitext('Local'):done()
:done()
:tag('tr')
:tag('th'):attr('rowspan',5):wikitext(image):done()
:tag('td'):wikitext(lvl_disp):done()
:tag('td'):wikitext(dbloot):done()
:tag('td'):wikitext(location):done()
:done()
:tag('tr')
:tag('th'):wikitext('EXP em Roubo'):done()
:tag('th'):wikitext('Saque triplo'):done()
:tag('th'):wikitext('Missão'):done()
:done()
:tag('tr')
:tag('td'):wikitext(xp_disp):done()
:tag('td'):wikitext(trloot):done()
:tag('td'):wikitext(quest):done()
:done()
:tag('tr')
:tag('th'):wikitext('Tempo de reaparecimento'):done()
:tag('th'):wikitext('Saque quadrúplo'):done()
:tag('th'):wikitext('Guardado por'):done()
:done()
:tag('tr')
:tag('td'):wikitext(respawn_disp):done()
:tag('td'):wikitext(qdloot):done()
:tag('td'):wikitext(guards):done()
:done()
:tag('tr')
:tag('th'):attr('colspan',4):wikitext('Saque'):done()
:done()
:tag('tr')
:tag('td'):attr('colspan',4):addClass('thvloot-cell'):wikitext(loot):done()
:done()
elseif multiloot and respawn then
t:tag('tr')
:tag('th'):wikitext(name):done()
:tag('th'):wikitext('Nível de Roubo'):done()
:tag('th'):wikitext('Saque duplo'):done()
:tag('th'):wikitext('Local'):done()
:done()
:tag('tr')
:tag('th'):attr('rowspan',5):wikitext(image):done()
:tag('td'):wikitext(lvl_disp):done()
:tag('td'):wikitext(dbloot):done()
:tag('td'):wikitext(location):done()
:done()
:tag('tr')
:tag('th'):wikitext('EXP em Roubo'):done()
:tag('th'):wikitext('Saque triplo'):done()
:tag('th'):wikitext('Missão'):done()
:done()
:tag('tr')
:tag('td'):wikitext(xp_disp):done()
:tag('td'):wikitext(trloot):done()
:tag('td'):wikitext(quest):done()
:done()
:tag('tr')
:tag('th'):wikitext('Tempo de reaparecimento'):done()
:tag('th'):wikitext('Saque quadrúplo'):done()
:tag('th'):wikitext('Saque'):done()
:done()
:tag('tr')
:tag('td'):wikitext(respawn_disp):done()
:tag('td'):wikitext(qdloot):done()
:tag('td'):addClass('thvloot-cell'):wikitext(loot):done()
:done()
elseif multiloot and stun and guards then
t:tag('tr')
:tag('th'):wikitext(name):done()
:tag('th'):wikitext('Nível de Roubo'):done()
:tag('th'):wikitext('Saque duplo'):done()
:tag('th'):wikitext('Local'):done()
:done()
:tag('tr')
:tag('th'):attr('rowspan',5):wikitext(image):done()
:tag('td'):wikitext(lvl_disp):done()
:tag('td'):wikitext(dbloot):done()
:tag('td'):wikitext(location):done()
:done()
:tag('tr')
:tag('th'):wikitext('EXP em Roubo'):done()
:tag('th'):wikitext('Saque triplo'):done()
:tag('th'):wikitext('Missão'):done()
:done()
:tag('tr')
:tag('td'):wikitext(xp_disp):done()
:tag('td'):wikitext(trloot):done()
:tag('td'):wikitext(quest):done()
:done()
:tag('tr')
:tag('th'):wikitext('Tempo de atordoamento / dano'):done()
:tag('th'):wikitext('Saque quadrúplo'):done()
:tag('th'):wikitext('Guardado por'):done()
:done()
:tag('tr')
:tag('td'):wikitext(stun_disp):done()
:tag('td'):wikitext(qdloot):done()
:tag('td'):wikitext(guards):done()
:done()
:tag('tr')
:tag('th'):attr('colspan',4):wikitext('Saque'):done()
:done()
:tag('tr')
:tag('td'):attr('colspan',4):addClass('thvloot-cell'):wikitext(loot):done()
:done()
elseif multiloot and stun then
t:tag('tr')
:tag('th'):wikitext(name):done()
:tag('th'):wikitext('Nível de Roubo'):done()
:tag('th'):wikitext('Saque duplo'):done()
:tag('th'):wikitext('Local'):done()
:done()
:tag('tr')
:tag('th'):attr('rowspan',5):wikitext(image):done()
:tag('td'):wikitext(lvl_disp):done()
:tag('td'):wikitext(dbloot):done()
:tag('td'):wikitext(location):done()
:done()
:tag('tr')
:tag('th'):wikitext('EXP em Roubo'):done()
:tag('th'):wikitext('Saque triplo'):done()
:tag('th'):wikitext('Missão'):done()
:done()
:tag('tr')
:tag('td'):wikitext(xp_disp):done()
:tag('td'):wikitext(trloot):done()
:tag('td'):wikitext(quest):done()
:done()
:tag('tr')
:tag('th'):wikitext('Tempo de atordoamento / dano'):done()
:tag('th'):wikitext('Saque quadrúplo'):done()
:tag('th'):wikitext('Saque'):done()
:done()
:tag('tr')
:tag('td'):wikitext(stun_disp):done()
:tag('td'):wikitext(qdloot):done()
:tag('td'):addClass('thvloot-cell'):wikitext(loot):done()
:done()
elseif multiloot and guards then
t:tag('tr')
:tag('th'):wikitext(name):done()
:tag('th'):wikitext('Nível de Roubo'):done()
:tag('th'):wikitext('Saque duplo'):done()
:tag('th'):wikitext('Local'):done()
:done()
:tag('tr')
:tag('th'):attr('rowspan',5):wikitext(image):done()
:tag('td'):wikitext(lvl_disp):done()
:tag('td'):wikitext(dbloot):done()
:tag('td'):wikitext(location):done()
:done()
:tag('tr')
:tag('th'):wikitext('EXP em Roubo'):done()
:tag('th'):wikitext('Saque triplo'):done()
:tag('th'):wikitext('Missão'):done()
:done()
:tag('tr')
:tag('td'):wikitext(xp_disp):done()
:tag('td'):wikitext(trloot):done()
:tag('td'):wikitext(quest):done()
:done()
:tag('tr')
:tag('td'):attr('rowspan',2):wikitext('<span title="Insira o tempo de atordoamento e dano ou tempo de reaparecimento" style="color:red; font-weight:bold; cursor:help; border-bottom:1px dotted red;">ERROR</span>'):done()
:tag('th'):wikitext('Saque quadrúplo'):done()
:tag('th'):wikitext('Guardado por'):done()
:done()
:tag('tr')
:tag('td'):wikitext(qdloot):done()
:tag('td'):wikitext(guards):done()
:done()
:tag('tr')
:tag('th'):attr('colspan',4):wikitext('Saque'):done()
:done()
:tag('tr')
:tag('td'):attr('colspan',4):addClass('thvloot-cell'):wikitext(loot):done()
:done()
elseif multiloot then
t:tag('tr')
:tag('th'):wikitext(name):done()
:tag('th'):wikitext('Nível de Roubo'):done()
:tag('th'):wikitext('Saque duplo'):done()
:tag('th'):wikitext('Local'):done()
:done()
:tag('tr')
:tag('th'):attr('rowspan',5):wikitext(image):done()
:tag('td'):wikitext(lvl_disp):done()
:tag('td'):wikitext(dbloot):done()
:tag('td'):wikitext(location):done()
:done()
:tag('tr')
:tag('th'):wikitext('EXP em Roubo'):done()
:tag('th'):wikitext('Saque triplo'):done()
:tag('th'):wikitext('Missão'):done()
:done()
:tag('tr')
:tag('td'):wikitext(xp_disp):done()
:tag('td'):wikitext(trloot):done()
:tag('td'):wikitext(quest):done()
:done()
:tag('tr')
:tag('td'):attr('rowspan',2):wikitext('<span title="Insira o tempo de atordoamento e dano ou tempo de reaparecimento" style="color:red; font-weight:bold; cursor:help; border-bottom:1px dotted red;">ERROR</span>'):done()
:tag('th'):wikitext('Saque quadrúplo'):done()
:tag('th'):wikitext('Saque'):done()
:done()
:tag('tr')
:tag('td'):wikitext(qdloot):done()
:tag('td'):addClass('thvloot-cell'):wikitext(loot):done()
:done()
elseif respawn and guards then
t:tag('tr')
:tag('th'):wikitext(name):done()
:tag('th'):wikitext('Nível de Roubo'):done()
:tag('th'):wikitext('Local'):done()
:done()
:tag('tr')
:tag('th'):attr('rowspan',5):wikitext(image):done()
:tag('td'):wikitext(lvl_disp):done()
:tag('td'):wikitext(location):done()
:done()
:tag('tr')
:tag('th'):wikitext('Nível de Roubo'):done()
:tag('th'):wikitext('Missão'):done()
:done()
:tag('tr')
:tag('td'):wikitext(xp_disp):done()
:tag('td'):wikitext(quest):done()
:done()
:tag('tr')
:tag('th'):wikitext('Tempo de reaparecimento'):done()
:tag('th'):wikitext('Guardado por'):done()
:done()
:tag('tr')
:tag('td'):wikitext(respawn_disp):done()
:tag('td'):wikitext(guards):done()
:done()
:tag('tr')
:tag('th'):attr('colspan',3):wikitext('Saque'):done()
:done()
:tag('tr')
:tag('td'):attr('colspan',3):addClass('thvloot-cell'):wikitext(loot):done()
:done()
elseif respawn then
t:tag('tr')
:tag('th'):wikitext(name):done()
:tag('th'):wikitext('Nível de Roubo'):done()
:tag('th'):wikitext('Local'):done()
:done()
:tag('tr')
:tag('th'):attr('rowspan',5):wikitext(image):done()
:tag('td'):wikitext(lvl_disp):done()
:tag('td'):wikitext(location):done()
:done()
:tag('tr')
:tag('th'):wikitext('EXP em Roubo'):done()
:tag('th'):wikitext('Missão'):done()
:done()
:tag('tr')
:tag('td'):wikitext(xp_disp):done()
:tag('td'):wikitext(quest):done()
:done()
:tag('tr')
:tag('th'):wikitext('Tempo de reaparecimento'):done()
:tag('th'):wikitext('Saque'):done()
:done()
:tag('tr')
:tag('td'):wikitext(respawn_disp):done()
:tag('td'):addClass('thvloot-cell'):wikitext(loot):done()
:done()
elseif stun and guards then
t:tag('tr')
:tag('th'):wikitext(name):done()
:tag('th'):wikitext('Nível de Roubo'):done()
:tag('th'):wikitext('Local'):done()
:done()
:tag('tr')
:tag('th'):attr('rowspan',5):wikitext(image):done()
:tag('td'):wikitext(lvl_disp):done()
:tag('td'):wikitext(location):done()
:done()
:tag('tr')
:tag('th'):wikitext('EXP em Roubo'):done()
:tag('th'):wikitext('Missão'):done()
:done()
:tag('tr')
:tag('td'):wikitext(xp_disp):done()
:tag('td'):wikitext(quest):done()
:done()
:tag('tr')
:tag('th'):wikitext('Tempo de atordoamento / dano'):done()
:tag('th'):wikitext('Guardado por'):done()
:done()
:tag('tr')
:tag('td'):wikitext(stun_disp):done()
:tag('td'):wikitext(guards):done()
:done()
:tag('tr')
:tag('th'):attr('colspan',3):wikitext('Saque'):done()
:done()
:tag('tr')
:tag('td'):attr('colspan',3):addClass('thvloot-cell'):wikitext(loot):done()
:done()
elseif stun then
t:tag('tr')
:tag('th'):wikitext(name):done()
:tag('th'):wikitext('Nível de Roubo'):done()
:tag('th'):wikitext('Local'):done()
:done()
:tag('tr')
:tag('th'):attr('rowspan',5):wikitext(image):done()
:tag('td'):wikitext(lvl_disp):done()
:tag('td'):wikitext(location):done()
:done()
:tag('tr')
:tag('th'):wikitext('EXP em Roubo'):done()
:tag('th'):wikitext('Missão'):done()
:done()
:tag('tr')
:tag('td'):wikitext(xp_disp):done()
:tag('td'):wikitext(quest):done()
:done()
:tag('tr')
:tag('th'):wikitext('Tempo de atordoamento / dano'):done()
:tag('th'):wikitext('Saque'):done()
:done()
:tag('tr')
:tag('td'):wikitext(stun_disp):done()
:tag('td'):addClass('thvloot-cell'):wikitext(loot):done()
:done()
elseif guards then
t:tag('tr')
:tag('th'):wikitext(name):done()
:tag('th'):wikitext('Nível de Roubo'):done()
:tag('th'):wikitext('Local'):done()
:done()
:tag('tr')
:tag('th'):attr('rowspan',5):wikitext(image):done()
:tag('td'):wikitext(lvl_disp):done()
:tag('td'):wikitext(location):done()
:done()
:tag('tr')
:tag('th'):wikitext('EXP em Roubo'):done()
:tag('th'):wikitext('Missão'):done()
:done()
:tag('tr')
:tag('td'):wikitext(xp_disp):done()
:tag('td'):wikitext(quest):done()
:done()
:tag('tr')
:tag('td'):attr('rowspan',2):wikitext('<span title="Insira o tempo de atordoamento e dano ou tempo de reaparecimento" style="color:red; font-weight:bold; cursor:help; border-bottom:1px dotted red;">ERROR</span>'):done()
:tag('th'):wikitext('Guarado por'):done()
:done()
:tag('tr')
:tag('td'):wikitext(guards):done()
:done()
:tag('tr')
:tag('th'):attr('colspan',3):wikitext('Saque'):done()
:done()
:tag('tr')
:tag('td'):attr('colspan',3):addClass('thvloot-cell'):wikitext(loot):done()
:done()
else
t:tag('tr')
:tag('th'):wikitext(name):done()
:tag('th'):wikitext('Nível de Roubo'):done()
:tag('th'):wikitext('Local'):done()
:done()
:tag('tr')
:tag('th'):attr('rowspan',5):wikitext(image):done()
:tag('td'):wikitext(lvl_disp):done()
:tag('td'):wikitext(location):done()
:done()
:tag('tr')
:tag('th'):wikitext('EXP em Roubo'):done()
:tag('th'):wikitext('Missão'):done()
:done()
:tag('tr')
:tag('td'):wikitext(xp_disp):done()
:tag('td'):wikitext(quest):done()
:done()
:tag('tr')
:tag('td'):attr('rowspan',2):wikitext('<span title="Insira o tempo de atordoamento e dano ou tempo de reaparecimento" style="color:red; font-weight:bold; cursor:help; border-bottom:1px dotted red;">ERROR</span>'):done()
:tag('th'):wikitext('Saque'):done()
:done()
:tag('tr')
:tag('td'):addClass('thvloot-cell'):wikitext(loot):done()
:done()
end
end
-- SMW
--[[This needs to be reworked as soon as infoboxes support switching and subobjects]] --
local nosmw = args.nosmw or false
if ns == '' and not nosmw then
local smwData = {['Thieving level'] = lvl, ['Thieving xp'] = xp, ['Loot respawn'] = respawn, ['Multiloot'] = multiloot, ['Stun time'] = stun, ['Stun damage'] = damage,}
if not version then
local versions
local variants = mw.smw.ask({'[[Is variant of::'..pgTitle..']]','?#-'})
if not variants then
versions = tostring(pgTitle) -- Data to page, has no variant subobjects
else
versions = {}
for _,v in ipairs(variants) do
local subobj = tostring(v[1])
subobj = string.gsub(subobj:match('%#[%w%s_%(%)]+$'), '%#', '')
table.insert(versions, subobj) -- Only add subobject name
end
end
if type(versions) == 'string' then
smwData['All Nível de Roubo'] = lvl -- Add "All Thieving level" property
mw.smw.set(smwData) -- Add data to page
else
for _,v in ipairs(versions) do
mw.smw.set({['All Nível de Roubo'] = lvl}) -- Add theiving lvl to "All Thieving level" of Object/Page
mw.smw.subobject(smwData, v) -- Add data to version subobjects
end
end
elseif type(version) == 'string' then
local versClean = string.gsub(string.sub(version,0,5), '%.', '')..string.sub(version,6)
-- In case NPC variants don't exist, assign them members status and child of
local smwVersion = mw.smw.ask({'[['..versClean..']]','?É somente para membros','?É variante de'})
local smwNPC = mw.smw.ask({'[['..pgTitle..']]','?É somente para membros'})
smwData['É somente para membros'] = smwVersion['É somente para membros'] or smwNPC['É somente para membros'] or false
smwData['É variante de'] = smwVersion['É variante de'] or pgTitle
mw.smw.set({['All Nível de Roubo'] = lvl}) -- Add theiving lvl to "All Thieving level" of Object/Page
mw.smw.subobject(smwData, versClean)
end
end
local cats = '[[Categoria:Entidades roubavéis]]'
if ns == '' then
t:wikitext(cats):done()
end
return t
end
-- For numerical args
function numberargs(arg,argname)
local arg_v = (arg or ''):find('%S') and string.gsub(arg,',','') or -1
local arg_i
if arg_v == -1 then
arg_i = nil
elseif string.lower(arg_v) == 'desconhecido' then
arg_i = 'Desconhecido'
elseif string.lower(arg_v) == 'n/a' then
arg_i = 'N/A'
elseif string.lower(arg_v) == 'varia' then
arg_i = 'Varia'
else
arg_i = tonumber(arg_v:gsub(',',''),10)
if not arg_i then
arg_i = badarg(argname,'precisa ser um valor número único.')
end
end
return arg_i
end
-- For times
function timearg(arg, argname)
local arg = tonumber(arg)
if not arg or arg%1 ~= 0 then
return badarg(argname,'precisa ser um número representado os tiques.')
end
local mins = 0
local secs = arg*0.6
while arg > 99 do
mins = mins+1
arg = arg-100
secs = arg*0.6
end
local disptime = secs
if mins<1 then
disptime = secs .. "s"
else --mins > 0
if secs < 1 then
disptime = mins .. "m"
else --secs > 0
disptime = mins .. "m " .. secs .. "s"
end
end
return disptime
end
-- For strings
function stringargs(arg, argname)
local ret
if not arg then
ret = '[[#|? (editar)|action=edit]]'
elseif type(arg) ~= 'string' then
return badarg(argname, 'precisa ser um texto.')
else
ret = string.match(arg or '','%S') and arg or '[[#|? (editar)|action=edit]]'
end
return ret
end
-- For double, tripple, quadruple loot
function lootlvl(lvl, loot)
loot = tonumber(loot)
if lvl and loot then
local thiev = lvl + loot
if thiev > 99 then
return '-'
end
local agil = lvl + loot - 10
local rett = tostring(thiev)..' '.._thvimg..'<br />'..tostring(agil)..' '.._aglimg
rett = mw.getCurrentFrame():preprocess(rett)
return rett
else
return nil
end
end
-- red ERR span with title hover for explanation
function badarg(argname, argmessage)
return '<span '..
'title="O parâmetro «'..argname..'» '..argmessage..'" '..
'style="color:red; font-weight:bold; cursor:help; border-bottom:1px dotted red;">'..
'ERR</span>'
end
return p