Garry's Mod Wiki

Revision Difference

timer.Exists#517894

<function name="Exists" parent="timer" type="libraryfunc"> <description>Returns whenever the given timer exists or not.</description> <realm>Shared and Menu</realm> <args> <arg name="identifier" type="string">Identifier of the timer.</arg> </args> <rets> <ret name="" type="boolean">Returns true if the timer exists, false if it doesn't</ret> </rets> </function> <example> <description>Checks it the timer exists</description> <code> if ( timer.Exists( "TimerName" ) ) then -- The timer exists print( "The timer exists" ) else -- The timer doesn't exist print( "The timer does not exist!" ) -- Create a timer timer.Create( "TimerName", 1, 0, function() print( "I'm a Timer" ) end) end </code> <output> The timer does not exist!&amp;lt;br&amp;gt; I'm a Timer&amp;lt;br&amp;gt; I'm a Timer&amp;lt;br&amp;gt; I'm a Timer&amp;lt;br&amp;gt; I'm a Timer&amp;lt;br&amp;gt; The timer does not exist!&lt;br&gt; I'm a Timer&lt;br&gt; I'm a Timer&lt;br&gt; I'm a Timer&lt;br&gt; I'm a Timer&lt;br&gt; </output> </example>