> For the complete documentation index, see [llms.txt](https://pellix-1.gitbook.io/pellix-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pellix-1.gitbook.io/pellix-docs/functions/set_callback.md). Agents can also search and read this documentation through its [MCP server](https://pellix-1.gitbook.io/pellix-docs/~gitbook/mcp).

# set\_callback

Function that sets callback to be dispatched by the client threads.

Only one callback can be set at once.

For all available callbacks see:

[Broken mention](broken://pages/4U5LDDwJv7U9ujMLkRr4)

**Example:**

```lua
local function on_draw()
    draw.circle(100, 100, 10, 0xFFFFFFFF)
end

set_callback("draw", on_draw)
```
