> For the complete documentation index, see [llms.txt](https://wiki.redmodding.org/scripting-cyberpunk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.redmodding.org/scripting-cyberpunk/cyber-engine-tweaks/cet-functions/events/onupdate.md).

# onUpdate

This event gets triggered on every frame that the game runs, thus is framerate dependent. The callback function gets the `deltaTime` passed along with it, which measures the frametime in ms, useful for making e.g. timers.

In here you can put any code that you want to run every frame, although it is best practice to only run your code when needed, e.g. using [Observers](/scripting-cyberpunk/cyber-engine-tweaks/cet-functions/observers.md).

{% hint style="warning" %}
Use this event with caution, as it is triggered continuously once the game is launched.
{% endhint %}

## Usage Example

{% code title="init.lua" %}

```lua
registerForEvent('onUpdate', function(deltaTime)

    print('It has been ' .. deltaTime .. ' ms since the last call')
    
end)
```

{% endcode %}
