> ## Documentation Index
> Fetch the complete documentation index at: https://lua.nlcrack.cc/llms.txt
> Use this file to discover all available pages before exploring further.

# Memory

> Direct memory access. Requires insecure mode.

## Functions

| Function | Returns | Description |
| - | - | - |
| `memory.read(type, address)` | value | Read a typed value |
| `memory.write(type, address, value)` | | Write a typed value |
| `memory.find_pattern(module, pattern)` | `number?` | Scan for an IDA-style byte pattern |
| `memory.module(name)` | `base, size` | Module base address and size |
| `memory.export(module, name)` | `number?` | Exported function address |
| `memory.interface(module, name)` | `number?` | CreateInterface result |

### Types

`int`, `uint`, `short`, `byte`, `int64`, `float`, `double`, `bool`, `ptr`, `string`.

## Example

```lua theme={null} theme={null}
local base, size = memory.module('client.dll')
print(string.format('client.dll: 0x%X (%d bytes)', base, size))

local addr = memory.find_pattern('client.dll', '48 8B 05 ? ? ? ? 48 85 C0 74 ? 48 8B 40')
if addr then
    local ptr = memory.read('ptr', addr + memory.read('int', addr + 3) + 7)
    print(string.format('found: 0x%X', ptr))
end
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.