File Duplex/Scheduler.lua
Functions
ScheduledTask:__init (ref, func, delay, args) | A class representing a scheduled task |
Scheduler:__init () | Initialize the Scheduler class |
Scheduler:_execute_task (task) | Execute a given task (using the provided context or anonymously) |
Scheduler:add_task (ref, func, delay, ...) | Add a new task to the scheduler |
Scheduler:on_idle () | Perform idle task (check when it's time to execute a task) |
Scheduler:remove_task (ref) | Remove a previously scheduled task |
Functions
- ScheduledTask:__init (ref, func, delay, args)
-
A class representing a scheduled task
Parameters:
-
ref
: (Object) the object to use as context (optional) -
func
: (Function) the function to call -
delay
: (Number) the delay before executing task -
args
: (Table) variable number of extra arguments
-
- Scheduler:__init ()
- Initialize the Scheduler class
- Scheduler:_execute_task (task)
-
Execute a given task (using the provided context or anonymously)
Parameters:
-
task
: (ScheduledTask) reference to the task
-
- Scheduler:add_task (ref, func, delay, ...)
-
Add a new task to the scheduler
Parameters:
-
ref
: (Object) the object to use as context (optional) -
func
: (Function) the function to call -
delay
: (Number) the delay before executing task -
...
: (Vararg) variable number of extra arguments
-
- Scheduler:on_idle ()
- Perform idle task (check when it's time to execute a task)
- Scheduler:remove_task (ref)
-
Remove a previously scheduled task
Parameters:
-
ref
: (ScheduledTask) reference to the task
-