timer
The timer library is a very useful set of functions which allow you to run a function periodically or after a given delay.
Methods
Adjusts a previously created (timer. Create) timer with the given identifier.
timer.Check()
We advise against using this. It may be changed or removed in a future update.
If you want to check if whether or not a timer exists, use timer. Exists.
This function does nothing.
Creates a new timer that will repeat its function given amount of times.
This function also requires the timer to be named, which allows you to control it after it was created via the timer.
For a simple one-time timer with no identifiers, see timer. Simple.
Timers use CurTime internally. Due to this, they won't advance while the client is timing out from the server or on an empty dedicated server due to hibernation. (unless sv_hibernate_think is set to 1).
We advise against using this. It may be changed or removed in a future update.
You should be using timer. Remove instead.
Stops and destroys the given timer. Alias of timer. Remove.
Returns whenever the given timer exists or not.
For debugging purposes you can use the following commands:
lua_dumptimers_cl
lua_dumptimers_sv
lua_dumptimers_menu
These will list all active timers in each realm.
Stops and removes a timer created by timer. Create.
The timers are removed in the next frame! Keep this in mind when storing identifiers in variables.
Returns amount of repetitions/executions left before the timer destroys itself.
Creates a simple timer that runs the given function after a specified delay.
For a more advanced version that you can control after creation, see timer. Create.
Timers use CurTime internally. Due to this, they won't advance while the client is timing out from the server or on an empty dedicated server due to hibernation. (unless sv_hibernate_think is set to 1).
Restarts the given timer.
Timers use CurTime for timing. Timers won't advance while the client is timing out from the server.
Returns amount of time left (in seconds) before the timer executes its function.
If the timer is paused, the amount will be negative.
Runs either timer. Pause or timer. UnPause based on the timer's current status.