mirror of
https://github.com/1bardesign/batteries.git
synced 2024-11-22 06:04:35 +00:00
fixed reset timer still counting as expired
This commit is contained in:
parent
bff54f0dbd
commit
a5c26038df
@ -22,7 +22,6 @@ function timer:new(time, on_progress, on_finish)
|
|||||||
self.timer = 0
|
self.timer = 0
|
||||||
self.on_progress = on_progress
|
self.on_progress = on_progress
|
||||||
self.on_finish = on_finish
|
self.on_finish = on_finish
|
||||||
self.has_expired = false
|
|
||||||
self:reset(time)
|
self:reset(time)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -58,6 +57,7 @@ end
|
|||||||
function timer:reset(time)
|
function timer:reset(time)
|
||||||
self.timer = 0
|
self.timer = 0
|
||||||
self.time = math.max(time or self.time, 1e-6) --negative time not allowed
|
self.time = math.max(time or self.time, 1e-6) --negative time not allowed
|
||||||
|
self.has_expired = false
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user