<ahref=#introductionclass=heading-link><iclass="fas fa-paperclip"></i></a></h3><p>If you ever want to run a piece of code on a timed interval, or want to wait
a few seconds, you don’t have to rely on timing tricks, as Hilbish has a
timer API to set intervals and timeouts.</p><p>These are the simple functions <code>hilbish.interval</code> and <code>hilbish.timeout</code> (doc
accessible with <code>doc hilbish</code>). But if you want slightly more control over
them, there is the <code>hilbish.timers</code> interface. It allows you to get
a timer via ID and control them.</p><p>All functions documented with the <code>Timer</code> type refer to a Timer object.</p><p>An example of usage:</p><pretabindex=0><code>local t = hilbish.timers.create(hilbish.timers.TIMEOUT, 5000, function()
<ahref=#functionsclass=heading-link><iclass="fas fa-paperclip"></i></a></h3><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><ahref=#timers.create>create(type, time, callback) -> @Timer</a></td><td>Creates a timer that runs based on the specified <code>time</code> in milliseconds.</td></tr><tr><td><ahref=#timers.get>get(id) -> @Timer</a></td><td>Retrieves a timer via its ID.</td></tr></tbody></table><h3id=static-module-fieldsclass=heading>Static module fields
<ahref=#static-module-fieldsclass=heading-link><iclass="fas fa-paperclip"></i></a></h3><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td>INTERVAL</td><td>Constant for an interval timer type</td></tr><tr><td>TIMEOUT</td><td>Constant for a timeout timer type</td></tr></tbody></table><h3id=functions-1class=heading>Functions
<ahref=#functions-1class=heading-link><iclass="fas fa-paperclip"></i></a></h3><hr><divid=timers.create><h4class=heading>hilbish.timers.create(type, time, callback) -> <ahref=/Hilbish/docs/api/hilbish/hilbish.timers/#timerstyle=text-decoration:noneid=lol>Timer</a>
<ahref=#timers.createclass=heading-link><iclass="fas fa-paperclip"></i></a></h4><p>Creates a timer that runs based on the specified <code>time</code> in milliseconds.
The <code>type</code> can either be <code>hilbish.timers.INTERVAL</code> or <code>hilbish.timers.TIMEOUT</code></p><h5id=parametersclass=heading>Parameters
<ahref=#parametersclass=heading-link><iclass="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><hr><divid=timers.get><h4class=heading>hilbish.timers.get(id) -> <ahref=/Hilbish/docs/api/hilbish/hilbish.timers/#timerstyle=text-decoration:noneid=lol>Timer</a>
<ahref=#timers.getclass=heading-link><iclass="fas fa-paperclip"></i></a></h4><p>Retrieves a timer via its ID.</p><h5id=parameters-1class=heading>Parameters
<ahref=#parameters-1class=heading-link><iclass="fas fa-paperclip"></i></a></h5><p>This function has no parameters.</p></div><h3id=typesclass=heading>Types
<ahref=#timerclass=heading-link><iclass="fas fa-paperclip"></i></a></h3><p>The Job type describes a Hilbish timer.</p><h3id=object-propertiesclass=heading>Object properties
<ahref=#object-propertiesclass=heading-link><iclass="fas fa-paperclip"></i></a></h3><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td>type</td><td>What type of timer it is</td></tr><tr><td>running</td><td>If the timer is running</td></tr><tr><td>duration</td><td>The duration in milliseconds that the timer will run</td></tr></tbody></table><h4id=methodsclass=heading>Methods