> For the complete documentation index, see [llms.txt](https://golua.fatality.win/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://golua.fatality.win/documentation/datatypes/timer.md).

# timer

utils.new\_timer

## Functions

### start

```lua
local timer = utils.new_timer(100, function()
    print("This will be printed every 100ms")
end)

timer:start()
```

#### Usage:

Begins the timer.

### stop

```lua
timer:stop()
```

#### Usage:

Pauses the timer.

### run\_once

```lua
local timer = utils.new_timer(100, function()
    print("This will be printed once")
end)

timer:run_once()
```

#### Usage:

Run a timer once.

### is\_active

```lua
local timer_active = timer:is_active()
```

#### Returns:

| [Value](/documentation/datatypes/timer.md) | [Datatype](/documentation/datatypes/timer.md) |
| :----------------------------------------: | :-------------------------------------------: |
|                timer's state               |                    boolean                    |

### set\_delay

```lua
local timer = utils.new_timer(0, function()
    print("This will be run every 1000ms")
end)
timer:set_delay(1000)
timer:start()
```

| [Parameter](/documentation/datatypes/timer.md) | [Datatype](/documentation/datatypes/timer.md) | [Description](/documentation/datatypes/timer.md) |
| :--------------------------------------------: | :-------------------------------------------: | :----------------------------------------------: |
|                      delay                     |                     number                    |  the amount of ms to change the timer's delay to |
