Name
Poke -- write to a memory block (V2.0)
Synopsis
Poke(id, offset, val[, type, endian])
Function
This function writes the value or string specified in val to the memory block with the identifier id at the specified offset. Type defaults to #INTEGER and specifies the type of val. You can also use the following types: #BYTE (1 byte), #SHORT (2 bytes), #FLOAT (4 byte single-precision floating point number), #DOUBLE (8 byte double-precision floating point number) or #STRING. Poking a string into a memory block occupies the number of characters in the string plus 1 byte.

Starting with Hollywood 6.0 there is a new endian parameter which allows you to specify the byte order that should be used when writing the data to 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 poke (in bytes)
val
data to poke; can be string or number
type
optional: data type to poke (defaults to #INTEGER)
endian
optional: byte order to use (defaults to #BIGENDIAN) (V6.0)
Example
AllocMem(1, 1024)
Poke(1, 0, "Hello World!", #STRING)
Print(Peek(1, 0, #STRING))
This will print "Hello World!" to the screen.

Show TOC