--- title: Module hilbish.timers description: timeout and interval API layout: doc menu: docs: parent: "API" --- ## Introduction 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. These are the simple functions `hilbish.interval` and `hilbish.timeout` (doc accessible with `doc hilbish`, or `Module hilbish` on the Website). An example of usage: ```lua local t = hilbish.timers.create(hilbish.timers.TIMEOUT, 5000, function() print 'hello!' end) t:start() print(t.running) // true ``` ## Functions ||| |----|----| |create(type, time, callback) -> @Timer|Creates a timer that runs based on the specified `time`.| |get(id) -> @Timer|Retrieves a timer via its ID.| ## Static module fields ||| |----|----| |INTERVAL|Constant for an interval timer type| |TIMEOUT|Constant for a timeout timer type|