mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 06:56:03 +01:00
fix(timer): accessing private variable out of scope (#591)
This commit is contained in:
@@ -41,28 +41,22 @@ function timer:start(async)
|
||||
|
||||
self.private.startTime = GetGameTimer()
|
||||
|
||||
local function tick(instance)
|
||||
while true do
|
||||
while instance.private.paused do
|
||||
local function tick()
|
||||
while self:getTimeLeft('ms') > 0 do
|
||||
while self:isPaused() do
|
||||
Wait(0)
|
||||
end
|
||||
|
||||
if instance:getTimeLeft('ms') <= 0 then
|
||||
break
|
||||
end
|
||||
|
||||
Wait(0)
|
||||
end
|
||||
self:onEnd()
|
||||
end
|
||||
|
||||
if async then
|
||||
Citizen.CreateThreadNow(function()
|
||||
tick(self)
|
||||
self:onEnd()
|
||||
tick()
|
||||
end)
|
||||
else
|
||||
tick(self)
|
||||
self:onEnd()
|
||||
tick()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user