Module scheduler

The Scheduler allows you to easily schedule functions for execution.

Under the hood it used minetest.register_on_globalstep to schedule functions.

Functions

init () Initializes the scheduler.
schedule (name, interval, run_function, overshoot_policy) Schedules the given function.
step (since_last_call) The step function that is registered with minetest.register_on_globalstep.
unschedule (name) Unschedules/Removes the function with the given name.

Tables

immediate_functions The table of functions for immediate execution.

Fields

OVERSHOOT_POLICY_CATCH_UP If more time has elapsed than the interval of the scheduled function, the function will be run as many times as necessary to catch up.
OVERSHOOT_POLICY_RUN_ONCE If more time has elpased than the interval of the scheduled function, the function will still only be run once.
initialized If the scheduler has been initialized.


Functions

init ()
Initializes the scheduler.

Note that the client should never need to call this function.

schedule (name, interval, run_function, overshoot_policy)
Schedules the given function.

Parameters:

  • name The name of the function.
  • interval The interval in which to run the function. A value of zero will make the function run on every global step, the overshoot policy will have no effect in that case.
  • run_function The function to execute.
  • overshoot_policy Optional. The overshoot policy. Defaults to scheduler.OVERSHOOT_POLICY_RUN_ONCE.
step (since_last_call)
The step function that is registered with minetest.register_on_globalstep.

Note that the client should never call this function as it might mess up the scheduled functions.

Parameters:

  • since_last_call The elapsed time since the last call.
unschedule (name)
Unschedules/Removes the function with the given name.

Parameters:

  • name The name of the function to unschedule.

Tables

immediate_functions
The table of functions for immediate execution.

Fields

OVERSHOOT_POLICY_CATCH_UP
If more time has elapsed than the interval of the scheduled function, the function will be run as many times as necessary to catch up.
OVERSHOOT_POLICY_RUN_ONCE
If more time has elpased than the interval of the scheduled function, the function will still only be run once.
initialized
If the scheduler has been initialized.
generated by LDoc 1.4.2