Modulo:Sandbox/Ignazio Cannata: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
Nessun oggetto della modifica
Etichette: Modifica da mobile Modifica da web per mobile
Omega Bot (discussione | contributi)
m Bot: rimuovo no globals obsoleto
 
(255 versioni intermedie di 3 utenti non mostrate)
Riga 1:
require('Module:No globalsstrict')
local p = {}
local debuglog = ''
local sv = '' -- sv: stringa vuota
 
function p.ciao( frame ) -- senza argomenti
return 'Ciao, mondoIgnazio!'
end
 
function p.ciao_nome1ciao_valore( frame )
return "Ciao, " ..if frame.args[1] .. ", " ..and frame.args[21] ..~= sv "?"then
debuglog = ' Questo messaggio compare perché alla funzione è stato assegnato un valore (valore scelto: ' .. frame.args[1] .. ').'
return "'Ciao, "Ignazio!' .. args[1] .. "!"debuglog
end
end
 
function p.ciao_nome1bciao_posizionale( frame )
return 'Ciao, ' .. mw.getContentLanguage():ucfirst((frame.args[1] or sv)) .. '! ' .. mw.getContentLanguage():ucfirst((frame.args[2] or sv)) .. '?'
local args = frame:getParent().args
if args[1] and args[2] then
return 'Ciao, ' .. args[1] .. ', ' .. args[2] .. '?'
end
if args[1] and not args[2] then
return "Ciao, " .. args[1] .. "!"
end
if not args[1] and args[2] then
return "" .. args[2] .. "?"
end
end
 
function p.ciao_nome2ciao_nominale1( frame )
return "'Ciao, "' .. mw.getContentLanguage():ucfirst((frame.args["nome"] or sv)) .. ",'! "' .. mw.getContentLanguage():ucfirst((frame.args["salutodomanda"] or sv)) .. "'?"'
end
 
function p.ciao_nome2bciao_nominale2( frame )
return "'Ciao, "' .. mw.getContentLanguage():ucfirst((frame.args.nome or sv)) .. ",'! "' .. mw.getContentLanguage():ucfirst((frame.args.salutodomanda or sv)) .. "'?"'
end
 
function p.ciao_transclusione(frame)
local args = frame:getParent().args
if (args[1] or args["nome"]) and (args[2] or args["domanda"]) and (args[2] or args["domanda"]) ~= sv then
debuglog = ' La domanda compare perché al secondo parametro è stato assegnato un valore. Il valore scelto è il seguente: ' .. tostring((args[2] or args["domanda"])) -- prova di controllo forzato
return 'Ciao, ' .. mw.getContentLanguage():ucfirst(((args[1] or args["nome"]) or sv)) .. '! ' .. mw.getContentLanguage():ucfirst((args[2] or args["domanda"])) .. '?' .. debuglog
else return 'Ciao, ' .. mw.getContentLanguage():ucfirst(((args[1] or args["nome"]) or sv)) .. '! ' .. ((args[2] or args["domanda"]) or sv) .. '?'
end
end