mirror of
https://github.com/Insality/druid
synced 2025-09-27 18:12:21 +02:00
Update
This commit is contained in:
@@ -14,13 +14,6 @@ local component = require("druid.component")
|
||||
local M = component.create("timer")
|
||||
|
||||
|
||||
local function second_string_min(sec)
|
||||
local mins = math.floor(sec / 60)
|
||||
local seconds = math.floor(sec - mins * 60)
|
||||
return string.format("%.2d:%.2d", mins, seconds)
|
||||
end
|
||||
|
||||
|
||||
---@param node node Gui text node
|
||||
---@param seconds_from number|nil Start timer value in seconds
|
||||
---@param seconds_to number|nil End timer value in seconds
|
||||
@@ -80,7 +73,7 @@ end
|
||||
---@return druid.timer self
|
||||
function M:set_to(set_to)
|
||||
self.last_value = set_to
|
||||
gui.set_text(self.node, second_string_min(set_to))
|
||||
gui.set_text(self.node, self:_second_string_min(set_to))
|
||||
|
||||
return self
|
||||
end
|
||||
@@ -111,4 +104,11 @@ function M:set_interval(from, to)
|
||||
end
|
||||
|
||||
|
||||
function M:_second_string_min(sec)
|
||||
local mins = math.floor(sec / 60)
|
||||
local seconds = math.floor(sec - mins * 60)
|
||||
return string.format("%.2d:%.2d", mins, seconds)
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
|
Reference in New Issue
Block a user