-
-
Notifications
You must be signed in to change notification settings - Fork 2
Module: TaskManager
Important
Documentation has moved to the docs. This wiki will no longer be updated, and may be deleted in the future.
local TaskManager = require("Starlit/TaskManager")The TaskManager module allows for scheduling code.
Many functions in this module take as argument a function to call and a list of arguments to call it with. Remember that if you are using objects, self should be passed as the first argument.
TaskManager.repeatEveryTicks(func: function, ticks: integer, ...: any)Creates a task to call a function every N ticks, where N is the ticks argument. Any trailing arguments are passed to the function when it is called.
Note: it is not guaranteed that each invocation of the function will be exactly N ticks apart. The task manager will spread out calls to each N ticks function over an N ticks period to attempt to flatten the performance impact of those functions. This means it may occasionally be called slightly earlier or later, especially after another task is added.
TaskManager.delayTicks(func: function, ticks: integer, ...: any)Creates a task to call a function once after N ticks, where N is the ticks argument. Any trailing arguments are passed to the function when it is called.
API to delay/repeat in real time and game time, as well as to cancel/remove already created tasks will be developed in the future.