Garry's Mod Wiki

Revision Difference

util.Timer#562634

<function name="Timer" parent="util" type="libraryfunc"> <description>Creates a timer object.</description> <description>Creates a timer object. The returned timer will be already started with given duration.</description> <realm>Shared and Menu</realm> <file line="217-L226">lua/includes/extensions/util.lua</file> <args> <arg name="startdelay" type="number" default="0">How long you want the timer to be.</arg> <arg name="duration" type="number" default="0">How long you want the timer to be. `Elapsed()` will return true only after this much time has passed.</arg> </args> <rets> <ret name="" type="table">A timer object. It has the following methods: * `Reset()` - Resets the timer to nothing⤶ * `Start( time )` - Starts the timer, call with end time⤶ * `Started()` - Returns true if the timer has been started⤶ * `Elapsed()` - Returns true if the time has elapsed</ret>⤶ * `Reset()` - Resets and stops the timer.⤶ * `Start( duration )` - (Re)starts the timer with given duration⤶ * `Started()` - Returns `true` if the timer has been started. It will continue to return true even after the duration has passed.⤶ * `Elapsed()` - Returns `true` if the timer duration has elapsed since its creation or the call to `Start()`</ret>⤶ </rets> </function>