Modulo:Sandbox/Ignazio Cannata: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
come chiesto
m Ripristino
Riga 1:
require('Module:No globals')
local p = {}
local debuglog = ''
local sv = '' -- sv: stringa vuota
 
function p.ciao(frame)
Riga 8 ⟶ 6:
end
 
function p.ciao_valoreciao_posizionale(frame)
ifreturn 'Ciao, ' .. frame.args[1] and.. '! ' .. frame.args[12] ~= sv.. then'?'
debuglog = ' Questo messaggio compare perché alla funzione è stato assegnato un valore (valore scelto: ' .. frame.args[1] .. ')'
return 'Ciao, Ignazio!' .. debuglog
end
end
 
function p.ciao_posizionaleciao_transclusione(frame)
local debuglog = ''
return 'Ciao, ' .. mw.getContentLanguage():ucfirst((frame.args[1] or sv)) .. '! ' .. mw.getContentLanguage():ucfirst((frame.args[2] or sv)) .. '?'
local args = frame:getParent().args
local outpot = 'Ciao, ' .. (args[1] or '') .. '! Questo messaggio compare perché "args2" è compilato:'
elseifif (args[1] or args["nome"]) and not (args[2] or args["domanda"]) then
debuglog = ' "args2" = ' .. tostring(args[2])
return outpot .. debuglog -- Cos'è args2?
elseif args[1] and not args[2] then
return 'Ciao, Ignazio!' .. debuglogargs[1] .. ''
end
end
 
function p.ciao_nominale1(frame)
return 'Ciao, ' .. mw.getContentLanguage():ucfirst((frame.args["nome"] or sv)) .. '! ' .. mw.getContentLanguage():ucfirst((frame.args["domanda"] or sv)) .. '?'
end
 
function p.ciao_nominale2(frame)
return 'Ciao, ' .. mw.getContentLanguage():ucfirst((frame.args.nome or sv)) .. '! ' .. mw.getContentLanguage():ucfirst((frame.args.domanda or sv)) .. '?'
end
 
function p.ciao_transclusione(frame)
local args = frame:getParent().args
local x = mw.getContentLanguage():ucfirst(((args[1] or args["nome"]) or sv))
if (args[1] or args["nome"]) and (args[2] or args["domanda"]) and (args[2] or args["domanda"]) ~= sv then
debuglog = ' Questo messaggio 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, ' .. x .. '!' .. debuglog
elseif (args[1] or args["nome"]) and (args[2] or args["domanda"]) and (args[2] or args["domanda"]) == sv then
return 'Ciao, ' .. x .. '!'
elseif (args[1] or args["nome"]) and not (args[2] or args["domanda"]) then
return 'Ciao, ' .. x .. '!'
end
end