Name
Peek -- look inside a memory block (V2.0)
Synopsis
val = Peek(id, offset[, type, len, endian])
Function
This function allows you to look inside a memory block at the specified offset. type specifies the data type for which you want to look. This can be #BYTE, #SHORT, #INTEGER, #FLOAT, #DOUBLE or #STRING. #BYTE will read one byte from the block, #SHORT reads two bytes, #INTEGER and #FLOAT four bytes, #DOUBLE eight bytes, and #STRING reads from the memory block until it encounters a non-graphical character or a NULL character.

Starting with Hollywood 2.5, you can specify the optional parameter len. This parameter can only be used with type #STRING. If specified, Peek() will read exactly len bytes from the specified memory block location and return it as a string. You can use this to read raw data from memory blocks because Peek() will not terminate at non-graphical or NULL characters any more if len is specified. If len is 0, which is the default setting, Peek() will read bytes until it encounters a non-graphical or NULL character.

Starting with Hollywood 6.0 there is a new endian parameter which allows you to specify the byte order that should be used when reading the data from the memory block. This can be set to the following types:

#BIGENDIAN:
Big endian byte order, MSB first. This is the default.

#NATIVEENDIAN:
Native endian byte order. If you use this type, the byte order will depend on the default byte order on the host system, i.e. big endian on big endian systems, little endian on little endian systems. Be careful using this type because it limits portability.

#LITTLEENDIAN:
Little endian byte order, LSB first. (V8.0)

Inputs
id
identifier of the memory block to be used
offset
where to peek (in bytes)
type
optional: data type to peek for (defaults to #INTEGER)
len
optional: number of bytes to read (works only in connection with type #STRING) (defaults to 0 which means read until a non-graphical or NULL character) (V2.5)
endian
optional: byte order to use (defaults to #BIGENDIAN) (V6.0)
Results
val
contents of the memory block at the specified offset; can be a value or a string (if type was set to #STRING)

Show TOC