Skip to content

Commit

Permalink
Update timer.rst
Browse files Browse the repository at this point in the history
Clearly show colon-syntax for timer-instance calls
  • Loading branch information
vrld committed Nov 2, 2015
1 parent 8440ee1 commit 8e65618
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion docs/timer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ Creates a new timer instance that is independent of the global timer: It will
manage it's own list of scheduled functions and does not in any way affect the
the global timer. Likewise, the global timer does not affect timer instances.

.. note::
Unlike the global instance, timer instaces need the colon sytax, i.e.
``instance:after()``) instead of ``Timer.after()``.

.. note::
If you don't need multiple independent schedulers, you can use the
global/default timer (see examples).
Expand All @@ -49,6 +53,8 @@ the global timer. Likewise, the global timer does not affect timer instances.

.. function:: Timer.after(delay, func)

.. function:: instance:after(delay, func)

:param number delay: Number of seconds the function will be delayed.
:param function func: The function to be delayed.
:returns: The timer handle. See also :func:`Timer.cancel`.
Expand Down Expand Up @@ -84,6 +90,8 @@ periodic behavior (see the example).

.. function:: Timer.every(delay, func[, count])

.. function:: instance:every(delay, func[, count])

:param number delay: Number of seconds between two consecutive function calls.
:param function func: The function to be called periodically.
:param number count: Number of times the function is to be called (optional).
Expand Down Expand Up @@ -116,6 +124,8 @@ or :func:`Timer.cancel` or :func:`Timer.clear` is called on the timer instance.

.. function:: Timer.during(delay, func[, after])

.. function:: instance:during(delay, func[, after])

:param number delay: Number of seconds the func will be called.
:param function func: The function to be called on ``update(dt)``.
:param function after: A function to be called after delay seconds (optional).
Expand Down Expand Up @@ -165,6 +175,8 @@ seconds have passed.

.. function:: Timer.cancel(handle)

.. function:: instance:cancel(handle)

:param table handle: The function to be canceled.

Prevent a timer from being executed in the future.
Expand All @@ -191,6 +203,8 @@ Prevent a timer from being executed in the future.

.. function:: Timer.clear()

.. function:: instance:clear()

Remove all timed and periodic functions. Functions that have not yet been
executed will discarded.

Expand All @@ -200,7 +214,7 @@ executed will discarded.

::

menu_timer:clear()
menuTimer:clear()


.. function:: Timer.update(dt)
Expand All @@ -227,6 +241,8 @@ Update timers and execute functions if the deadline is reached. Call in

.. function:: Timer.tween(duration, subject, target, method, after, ...)

.. function:: instance:tween(duration, subject, target, method, after, ...)

:param number duration: Duration of the tween.
:param table subject: Object to be tweened.
:param table target: Target values.
Expand Down

0 comments on commit 8e65618

Please sign in to comment.