Módulo:Zona de pruebas/Funez Remiaw/01
Este módulo no tiene página de documentación[crear]
-- PROTOTIPO DE CALCULADOR DE DURACIONES DE UNA LISTA DE CANCIONES
local x = {}
local h = 0
local ActivarHora = true
function x.total(frame)
--Segundos
s = string.sub(frame.args[1], -2) + string.sub(frame.args[2], -2) + string.sub(frame.args[3], -2)
if s > 60 then
r = math.floor(s / 60)
s = s - (r * 60)
end
if #tostring(s) == 1 then
s = "0".. s
end
--Minutos
m = string.sub(frame.args[1], 1, -4) + string.sub(frame.args[2], 1, -4) + string.sub(frame.args[3], 1, -4) + r
if m > 60 and ActivarHora == true then
h = math.floor(m / 60)
m = m - (h * 60)
end
if #tostring(m) == 1 then
m = "0".. m
end
--Resultado
if h == 0 then
return m ..":".. s
else
return h ..":".. m ..":".. s
end
end
return x