Skip to content

mwseTimer⚓︎

A Timer is a class used to keep track of callback that should be invoked at a later time.

Properties⚓︎

callback⚓︎

Read-only. The callback that will be invoked at the end of each iteration.

Returns:


data⚓︎

Arbitrary json-serializable data stored in the timer. This defaults to nil, but can be set at the time of timer creation, or changed later.

Returns:

  • result (table, nil)

duration⚓︎

Read-only. The duration of single iteration of the timer in seconds for timers of timer.real and timer.simulate types. It's in hours for timer.game timers.

Returns:

  • result (number)

iterations⚓︎

Read-only. The amount of iterations left for the timer.

Returns:

  • result (integer)

state⚓︎

Read-only. The state of the timer, matching timer.active, timer.paused, or timer.expired.

Returns:

  • result (integer)

timeLeft⚓︎

Read-only. The amount of time left before the current iteration of the timer will complete. Reset to duration value at the end of each iteration.

Returns:

  • result (number)

timing⚓︎

Read-only. This is the time in the owning mwseTimerController's clock when the current iteration of the timer ends. It's updated for each iteration. For paused timers its equal to the number of seconds/hours left for the current iteration.

Returns:

  • result (number)

Methods⚓︎

cancel⚓︎

Cancels the timer.

local canceled = myObject:cancel()

Returns:

  • canceled (boolean)

pause⚓︎

Pauses the timer.

local paused = myObject:pause()

Returns:

  • paused (boolean)

reset⚓︎

Resets the timer completion time and iterations count.

myObject:reset()

resume⚓︎

Resumes a paused timer.

local resumed = myObject:resume()

Returns:

  • resumed (boolean)