Superseded / Deprecated
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's "Superseded by..." section for specific details.
peek( addr )
- Reads a byte from a memory location.
- addr
-
- 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 | edit source]
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 | edit source]
b = peek(0x4300)
b = @0x4300 -- preferred method
See also[edit | edit source]
Community content is available under CC-BY-SA unless otherwise noted.