Garry's Mod Wiki

Revision Difference

timer.Remove#519447

<function name="Remove" parent="timer" type="libraryfunc"> <description>Stops and removes a timer created by <page>timer.Create</page>. <warning>The timers are removed in the next frame! Keep this in mind when storing identifiers in variables.</warning> </description> <realm>Shared and Menu</realm> <args> <arg name="identifier" type="string">Identifier of the timer to remove.</arg> </args> </function> <example> ⤶ <description>Removes a timer and clears the identifier.</description>⤶ ⤶ <description>Creates a timer and then removes it</description>⤶ <code> timer.Remove(identifier_1)⤶ timer.Remove(identifier_2) -- make sure that the identifier is cleared in the next frame⤶ timer.Simple(0, function() identifier_1 = nil⤶ identifier_2 = nil⤶ end)⤶ </code>⤶ ⤶ -- create timer⤶ timer.Create( "UniqueName1", 5, 1, function() print("inside") end ) -- remove timer⤶ timer.Remove( "UniqueName1" ) ⤶ </code>⤶ </example>