Skip to content

pyux.set_timer_handler

Daniel Flassig edited this page Jun 17, 2026 · 5 revisions

Sets up a timer and its handler function for timed-events in the current modal scope. A call to [pyux.start_timer] is required to set the frequency and start the newly created timer.

pyux.set_timer_handler(handler)
pyux.set_timer_handler(handler, existing_timer)

Parameters

Type Description
handler function A lua function that is invoked when the timer event occurs. nil will remove the handler.
existing_timer timer_token Identifier of an existing timer

Return value

Type Description
timer_token A value that should be passed to pyux.start_timer to identify the timer

Callback

The parameters to the handler function are as follows:

function on_timer_handler(info)
Type Description
info {...} A table containing the following key-value pairs:
info.timer_id timer_token Matches the return value of set_timer_handler

Note:

This timer is specific to the current modal scope.

To delete an existing timer, call pyux.set_timer_handler(nil, existing_timer). All remaining timers are automatically cleaned up at the end of the modal scope.

Use pyux.start_timer to start the timer and pass the timer_token.

To create fluid animations in 3D space, animations should be preferred! Their frequency is automatically adjusted to the capabilities of the user system.

Version requirements

This function is available in V26 and above.

See also

pyux, start_timer, stop_timer, set_animation_handler

Clone this wiki locally