This commit is contained in:
Insality
2025-03-05 22:10:37 +02:00
parent 46223f0bb8
commit 72692f5efc
5 changed files with 13 additions and 8 deletions

View File

@@ -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