timer.Simple
From GMod Wiki
Function | |
Syntax |
timer.Simple( Float delay, Function func, ... ) Where is this used? |
Description: | |
Runs a function with the given arguments after a certain number of seconds has passed. | |
Returns: | Boolean |
Part of Library: | Timer |
Realm: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Timer.Simple]Timer.Simple [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
Description | Creates a new simple timer. |
---|---|
Used on | |
Code | timer.Simple(5, Msg, "This message will display after 5 seconds!") |
Output | (After 5 seconds has elapsed) "This message will display after 5 seconds!" |
Additional Notes
- Passes the arguments you give it to the function.
- This function always returns true, no matter what.
- This timer is dealt with differently than by calling timer.Create. You won't be able to use any functions on it that required a named timer (timer.IsTimer, timer.Adjust, etc).
- To use to call on a class function, like 'self:PrimaryAttack()', follow this format: 'timer.simple( 2, self.PrimaryAttack, self )'. Use 'self' as first function parameter.
- Setting a delay of less than or equal to zero will cause the timer function to be called on the next frame. This allows infinite recursion without the risk of hitting the infinite loop checker.