17 214
contributi
(Correzione errori *** sovrascritto il testo esistente ***) |
|||
w.interp = function(s, tab)
return (s:gsub('($%b{})', function(w) return tab[w:sub(3, -2)] or w end))
end
-- Aggiunge gli zeri a sinistra ai numeri con meno di tre cifre:
-- dato che valori numerici di questo tipo non sono supportati,
-- la funzione restituisce stringhe
w.three_figures = function(n)
if n < 10 then
return '00' .. n
elseif n < 100 then
return '0' .. n
else
return tostring(n)
end
end
w.linear_search = function(tab, value)
for a, b in pairs(tab) do
return true
end
return false
|
contributi