Modulo:Demografia/sandbox: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
mNessun oggetto della modifica
Nessun oggetto della modifica
Riga 48:
-- Crea tabella laterale
-- =====================================================================
local function formato(a)
local k
local s = ''..a
while true do
s, k = s:gsub("^(-?%d+)(%d%d%d)", '%1 %2')
if (k==0) then break end
end
return s
end
 
local function mostraTabella(a,b,f)
local ss = {}
Riga 55 ⟶ 65:
local c = math.floor(0.5+#b/2)
for i =1,c do
table.insert(ss,string.format('<tr><th>%s</th><td>%s</td>',a[i],formato(math.floor(b[i]*f+0.5))))
if b[i+c] then table.insert(ss,string.format('<th>%s</th><td>%s</td>',a[i+c],formato(math.floor(b[i+c]*f+0.5)))) end
table.insert(ss,'</tr>')
end
Riga 62 ⟶ 72:
table.insert(ss,'</tr>')
for i =1,#b do
table.insert(ss,string.format('<tr><th>%s</th><td>%s</td></tr>',a[i],formato(math.floor(b[i]*f+0.5))))
end
end