Checking if a timer.Create is paused.

Hello,

I’m wondering if there’s a way to check if a timer is paused, I’ve tried something like:


if timer.Pause( "Test" ) == true then

elseif timer.Pause( "Test" ) == false then

end

But this doesn’t seem to work, I heard there’s something called timer.Check(), but don’t think that’s correct.

timer.Pause returns “false if the timer didn’t exist or was already paused, true otherwise.”

So if you want to check if it’s paused, it’s going to be paused if it exists.
[lua]
local e = timer.Exists(“TestTimer”)
local p = timer.Pause(“TestTimer”)

– Since it returns false if it doesn’t exist OR was already paused
– we need to differentiate what it was returning false for

if § then
– timer was just paused
– just unpause it here if you don’t want it paused
elseif (e) then
– timer was already paused
else
– timer doesn’t exist
end
[/lua]

[editline]21st October 2017[/editline]

You could store a boolean in a table every time you create a timer, then just change that when you pause/unpause it as well. (and use that to check if it is paused)