By Apache

Time Format

Lua 707 Bytes 42 one month ago one month ago
local function round(num) return math.floor(num + 0.5) end local function format(seconds) seconds = round(seconds) local minutes, hours = 0, 0 if seconds >= 60 then minutes = round(seconds / 60) seconds = seconds - minutes * 60 if minutes >= 60 then hours = round(minutes / 60) minutes = minutes - hours * 60 return hours .. ":" .. (minutes > 9 and tostring(minutes) or "0" .. minutes) .. ":" .. (seconds > 9 and tostring(seconds) or "0" .. seconds) else return minutes .. ":" .. (seconds > 9 and tostring(seconds) or "0" .. seconds) end else return seconds > 9 and tostring(seconds) or "0" .. seconds end end print(format(69))