Modulo:Discendenza/sandbox: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
mNessun oggetto della modifica
mNessun oggetto della modifica
Riga 5:
local pers = {}
local tabella = {}
local sstxt = ''{}
 
local function agg(t)
table.insert(txt,t)
end
 
local function dividi(dati)
Line 21 ⟶ 26:
if (px) then
if (pers[nx]) then
err = string.format('inserito id = <b>%d utilizzato</b> per elementipiù diversielementi',nx)
else
pers[nx] = { padre = px, testo = dati[m-1], nota = dati[m], id = -1, x = -1, y = -1, sp = 0, figli = {} }
end
else
err = string.format('inserito id genitore = <b>%s</b> non numerico per(id elemento= <b>%d</b>)',dati[m-2],nx)
end
else
err = string.format('inserito id elemento= <b>%s</b> non numerico',dati[m-3])
end
resto = n-m
end
if (err == '-' and resto > 0) then
err = string.format('numero di dati $%d non valido (elementi in più: $%d)',n,resto)
end
return err
Line 195 ⟶ 200:
local s1, s2, s3
local xx, xp
local ss = ''
if (allinea == 'destra') then
ss = agg('<div class="floatright" style="width:'..largo..'px;padding:3px;background:#fff;border:1px solid #c8ccd1"><table cellpadding="1" cellspacing="0" border=0 style="text-align:center;font-size:95%;line-height:110%;margin:0px auto">')
else
ss = agg('<center><table cellpadding="1" cellspacing="0" border=0 style="text-align:center;font-size:95%;line-height:110%;margin:10px auto">')
end
local lg = math.floor(100/(xy[1]+2))
Line 248 ⟶ 252:
if (n<xy[2]) then s3 = s3..'</tr>' end
 
ss = ss..agg(s1..);agg(s2..);agg(s3)
end
 
ss = ss..agg('</table>')
if (allinea == 'destra') then ss = ss..agg('</div>') else ss = ss..agg('</center>') end
 
return sstable.concat(txt)
end
 
Line 286 ⟶ 290:
capo = i
else
err = string.format('inseriti più elementi come capostipite (id: = <b>%d, %d</b>) indicati come capostipite',capo,i)
end
else
if (v.padre == i) then
err = string.format('elementoinserito con id %d indicatoelemento come figlio di se stesso (id = <b>%d</b>)', i)
elseif (pers[v.padre]) then
table.insert(pers[v.padre].figli,i)
else
err = string.format('inserito id genitore = <b>%d</b> non valido in elemento con (id = <b>%d</b>)',v.padre,i)
end
end
Line 309 ⟶ 313:
calcolaX3(capo, 0)
else
err = 'alcuniinseriti elementi non sono collegati al capostipite'
end
end