summaryrefslogtreecommitdiffstats
path: root/DOCS/man/en
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-04-02 17:09:45 +0200
committerwm4 <wm4@nowhere>2014-04-02 17:09:45 +0200
commite3e9661a33e9c810a6f6be6cd76978d1c2df9ec4 (patch)
treee2c40276307262a4fde78bac5b12b501fcb7215e /DOCS/man/en
parent3207366daab937bafe2029ee231257c51188d6b2 (diff)
downloadmpv-e3e9661a33e9c810a6f6be6cd76978d1c2df9ec4.tar.bz2
mpv-e3e9661a33e9c810a6f6be6cd76978d1c2df9ec4.tar.xz
lua: give more control over timers
Now they can be paused and resumed. Since pausing and disabling the timer is essentially the same underlying operation, we also just provide one method for it. mp.cancel_timer probably still works, but I'm considering this deprecated, and it's removed from the manpage. (We didn't have a release with this function yet, so no formal deprecation.)
Diffstat (limited to 'DOCS/man/en')
-rw-r--r--DOCS/man/en/lua.rst22
1 files changed, 17 insertions, 5 deletions
diff --git a/DOCS/man/en/lua.rst b/DOCS/man/en/lua.rst
index 34d1d0e8c3..ac37f1eabb 100644
--- a/DOCS/man/en/lua.rst
+++ b/DOCS/man/en/lua.rst
@@ -248,17 +248,29 @@ The ``mp`` module is preloaded, although it can be loaded manually with
This is a one-shot timer: it will be removed when it's fired.
- Returns a timer handle. See ``mp.cancel_timer``.
+ Returns a timer object. See ``mp.add_periodic_timer`` for details.
``mp.add_periodic_timer(seconds, fn)``
Call the given function periodically. This is like ``mp.add_timeout``, but
the timer is re-added after the function fn is run.
- Returns a timer handle. See ``mp.cancel_timer``.
+ Returns a timer object. The timer object provides the following methods:
+
+ ``stop()``
+ Disable the timer. Does nothing if the timer is already disabled.
+ This will remember the current elapsed time when stopping, so that
+ ``resume()`` essentially unpauses the timer.
+
+ ``kill()``
+ Disable the timer. Resets the elapsed time.
+
+ ``resume()``
+ Restart the timer. If the timer was disabled with ``stop()``, this
+ will resume at the time it was stopped. If the timer was disabled
+ with ``kill()``, or if it's a previously fired one-shot timer (added
+ with ``add_timeout()``), this starts the timer from the beginning,
+ using the initially configured timeout.
-``mp.cancel_timer(t)``
- Terminate the given timer. t is a timer handle (value returned by
- ``mp.add_timeout`` or ``mp.add_periodic_timer``).
``mp.get_opt(key)``
Return a setting from the ``--lua-opts`` option. It's up to the user and