1.4 KiB
1.4 KiB
Timer
The Timer is a non-visual element that can be used to perform actions at specific intervals.
Extends: BaseElement
Properties
| Property | Type | Default | Description |
|---|---|---|---|
| interval | number | 1 | The interval in seconds at which the timer will trigger its action. |
| action | function | function | The action to be performed when the timer triggers. |
| running | boolean | false | Indicates whether the timer is currently running or not. |
| amount | number | -1 | The amount of time the timer should run. |
Functions
| Method | Returns | Description |
|---|---|---|
| Timer.new | table | Creates a new Timer instance |
| Timer:Timer | - | Initializes the Timer instance |
| Timer:Timer | Timer | Starts the timer |
| Timer:Timer | Timer | Stops the timer |
| Timer:Timer | - | Dispatches events to the Timer instance |
Timer.new()
Returns
tableselfThe created instance
Timer:Timer(props, basalt)
Parameters
propstableThe properties to initialize the element withbasalttableThe basalt instance
Timer:Timer(self)
Starts the timer with the specified interval.
Parameters
selfTimerThe Timer instance to start
Returns
TimerselfThe Timer instance
Timer:Timer(self)
Stops the timer if it is currently running.
Parameters
selfTimerThe Timer instance to stop
Returns
TimerselfThe Timer instance