mirror of
https://github.com/mpv-player/mpv
synced 2024-12-25 00:02:13 +00:00
lua: add timer:is_enabled() function
Allows to query if some timer is currently running or was stopped/killed.
This commit is contained in:
parent
449b948ee8
commit
6ae7a555bf
@ -350,6 +350,10 @@ The ``mp`` module is preloaded, although it can be loaded manually with
|
||||
with ``add_timeout()``), this starts the timer from the beginning,
|
||||
using the initially configured timeout.
|
||||
|
||||
``is_enabled()``
|
||||
Whether the timer is currently enabled or was previously disabled
|
||||
(e.g. by ``stop()`` or ``kill()``).
|
||||
|
||||
``timeout`` (RW)
|
||||
This field contains the current timeout period. This value is not
|
||||
updated as time progresses. It's only used to calculate when the
|
||||
|
@ -275,6 +275,10 @@ function timer_mt.resume(t)
|
||||
end
|
||||
end
|
||||
|
||||
function timer_mt.is_enabled(t)
|
||||
return timers[t] ~= nil
|
||||
end
|
||||
|
||||
-- Return the timer that expires next.
|
||||
local function get_next_timer()
|
||||
local best = nil
|
||||
|
Loading…
Reference in New Issue
Block a user