-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtimer.lua
More file actions
20 lines (16 loc) · 727 Bytes
/
Copy pathtimer.lua
File metadata and controls
20 lines (16 loc) · 727 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Timer = { }
-- ------------------------------------------------------------------------------------------------------
-- Formats the display timer.
-- ------------------------------------------------------------------------------------------------------
---@param time? number duration in seconds.
---@return string
-- ------------------------------------------------------------------------------------------------------
Timer.Format = function(time)
if not time then
return '00:00'
end
local minute, second
minute = string.format('%02.f', math.floor((time / 60)))
second = string.format('%02.f', math.floor(time % 60))
return string.format('%s:%s', tostring(minute), tostring(second))
end