timer.Simple

From GMod Wiki

Jump to: navigation, search
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: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Timer.Simple]Timer.Simple [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionCreates a new simple timer.
Used onNewerShared.png
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!"


DescriptionCalls YourFunction() after 5 seconds.
Used onNewerShared.png
Code
 
 
local function YourFunction( message, ply)
ply:Msg(message)
end
 
timer.Simple( 5, YourFunction, "Hello!", ply )
 
 
 
 
OutputAfter 5 seconds has elapsed YourFunction() will be called and will say the "Hello!" message


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox