Skip to content

Memory ​

Direct memory reads via the kernel driver. For power users who want to read offsets they've found themselves.

If you don't already know what offsets are or how to find them, you don't need this namespace. The player and world objects expose everything the cheat itself uses.

Functions ​

FunctionReturnsDescription
memory.read(type, address)variesRead a single value at an address
memory.read_chain(type, base, offsets)variesFollow a pointer chain and read the final value
memory.batch_read(entries)tableRead multiple values in one call
memory.get_client_base()integerBase address of client.dll
memory.get_entity_list()integerPointer to the entity list

Supported types ​

Type stringReads
"float"4-byte float
"double"8-byte double
"int"4-byte signed int
"uint"4-byte unsigned int
"int64"8-byte signed int
"uint64"8-byte unsigned int
"short"2-byte signed int
"byte"1-byte unsigned int
"bool"1-byte boolean
"ptr"Pointer-sized integer

read ​

Single value at an address.

lua
local base = memory.get_client_base()
local some_offset = 0x1A2B3C4
local x = memory.read("float", base + some_offset)

read_chain ​

Follow a pointer chain. The base is read as a pointer, then each offset is added and dereferenced as a pointer except the last, which is read as the requested type.

lua
-- Equivalent to: *(float*)(*(*(*(base + o1)) + o2) + o3)
local hp = memory.read_chain("float", base, { 0x10, 0x28, 0x4C })

batch_read ​

Read many values in a single driver call. Cheaper than calling read in a loop.

lua
local results = memory.batch_read({
    { type = "float", address = 0x12340000 },
    { type = "int",   address = 0x12340004 },
    { type = "ptr",   address = 0x12340008 },
})
-- results[1], results[2], results[3]

get_client_base / get_entity_list ​

lua
local client = memory.get_client_base()
local list   = memory.get_entity_list()

Use these as starting points if you have offsets relative to client.dll or relative to the entity list.

Caveats ​

  • Bad addresses return 0 or nil rather than crashing.
  • Offsets shift between game patches. The cheat itself updates its offsets server-side; your own scripts have to update theirs.
  • Memory reads are slower than the player/world API. Cache results if you're reading the same address every tick.

Not affiliated with Valve Corporation.