mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-18 15:36:02 +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()
|
self.private.startTime = GetGameTimer()
|
||||||
|
|
||||||
local function tick(instance)
|
local function tick()
|
||||||
while true do
|
while self:getTimeLeft('ms') > 0 do
|
||||||
while instance.private.paused do
|
while self:isPaused() do
|
||||||
Wait(0)
|
Wait(0)
|
||||||
end
|
end
|
||||||
|
|
||||||
if instance:getTimeLeft('ms') <= 0 then
|
|
||||||
break
|
|
||||||
end
|
|
||||||
|
|
||||||
Wait(0)
|
Wait(0)
|
||||||
end
|
end
|
||||||
|
self:onEnd()
|
||||||
end
|
end
|
||||||
|
|
||||||
if async then
|
if async then
|
||||||
Citizen.CreateThreadNow(function()
|
Citizen.CreateThreadNow(function()
|
||||||
tick(self)
|
tick()
|
||||||
self:onEnd()
|
|
||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
tick(self)
|
tick()
|
||||||
self:onEnd()
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user