> For the complete documentation index, see [llms.txt](https://0x29a.gitbook.io/0x29a-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://0x29a.gitbook.io/0x29a-docs/globals/helpers.md).

# Utility functions

**bootstrap (Lua) · console-friendly**

These aren't native bindings — they're plain Lua, compiled into the bootstrap on top of `mem`/`disasm`/`sig`/`pe`/`func`/`sym`. Mainly meant for interactive use in the overlay's **Console** during reverse engineering; scripts are free to call them too.

### `addr(n) -> string`

Formats `n` as hex: `"0x1A2B3C"`.

### `rva(n) -> integer`

Converts an absolute address to an offset relative to the main module: `n - proc.base`.

### `va(off) -> integer`

The reverse of `rva`: `proc.base + off`.

### `module(name) -> {name, base, size} | nil`

Short alias for [`mem.module(name)`](/0x29a-docs/memory-and-analysis/mem.md#mem-module-name-or-nil-table-nil).

### `hex(addr [, n=16])`

Prints a hex+ASCII dump of `n` bytes starting at `addr`, formatted like a traditional disassembler (16 bytes per line, offset + hex + ASCII column).

```
0x00007FF6A1B2C3D0  48 8B 05 A1 22 03 00 48 8B 88 F0 00 00 00 C3 90  |H..."..H........|
```

### `disas(addr [, n=10])`

Disassembles `n` instructions starting at `addr` and prints them, resolving each one's symbol via [`sym.name`](/0x29a-docs/memory-and-analysis/sym.md#sym-name-addr-string-nil) when available.

### `exports(module_or_base [, fn_name])`

Without `fn_name`, lists every export of the module. With `fn_name`, resolves and prints just that export (and returns its address).

```lua
exports("kernel32.dll")             -- list everything
exports("kernel32.dll", "CreateFileW")  -- resolve one specific export
```

### `sections(module_or_base)`

Prints the module's sections with their protection flags (`X`/`W`/`R`).

### `mksig(addr [, n=32]) -> pattern`

Generates a signature with [`sig.create`](/0x29a-docs/memory-and-analysis/sig.md#sig-create-addr-len-pattern), prints it, and immediately validates it by scanning back — warns if the result doesn't land on the same address (`MISMATCH`).

### `follow(base, off1 [, off2, ...]) -> addr | nil`

Like [`mem.deref`](/0x29a-docs/memory-and-analysis/mem.md#mem-deref-base-off1-off2-addr-nil), but prints each step of the pointer chain as it resolves — great for debugging a new chain in the console.

```
> follow(local_player, 0xF0, 0x334)
  base = 0x1A2B3C4D5E
  [+0xF0] -> 0x1A2B400000
  [+0x334] -> 0x64
```

### `scan(value [, type="u32"]) -> [addr]`

Calls [`mem.scan_value`](/0x29a-docs/memory-and-analysis/mem.md#mem-scan-value-value-type-str-start-size-addr) across every module and prints up to 20 results.

### `findstr([pattern] [, minlen=4])`

Searches the main module for ASCII strings, optionally filtered by a Lua pattern (`string.find`). Prints up to 100 results.

### `analyze(addr)`

A function summary: symbol name, size, call list and xrefs — combines [func](/0x29a-docs/memory-and-analysis/func.md) and [sym](/0x29a-docs/memory-and-analysis/sym.md) into a single print.

### `lsmod()`

Lists every loaded module, sorted by name.

### `vec2(x, y) -> {x, y}`

### `color(r, g, b [, a=1]) -> {r, g, b, a}`

Table constructors used by [render](/0x29a-docs/interface/render.md) and the `dl_*` functions in [ui](/0x29a-docs/interface/ui.md#draw-list-current-window).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://0x29a.gitbook.io/0x29a-docs/globals/helpers.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
