The feature described in this article has been superseded by a newer feature. This feature still works in PICO-8, but the new feature should be used instead. See the article for specific details.
peek( addr )
Reads a byte from a memory location.
The address of the memory location.

The peek() function reads a byte from the addressable memory region (0x000-0x7fff). See Memory for information about the memory layout.

See peek2() for a way to read a 16-bit value from two consecutive memory addresses, and peek4() to read a 32-bit value from four consecutive memory addresses.

Superseded by @ operator Edit

The unary-@ operator added in 0.2.0 performs the same function as peek() and is now the recommended way to read a byte of memory, as it uses fewer tokens, costs fewer cycles at runtime, and runs on the real host CPU much more efficiently. Simply replace peek(address) with @address.

Examples Edit

b = peek(0x4300)
b = @0x4300      -- preferred method

See also Edit

Community content is available under CC-BY-SA unless otherwise noted.