buffer_poke

With this function you can write data into a buffer at the specified offset, without changing the seek position. This is different from buffer_write, which uses the current seek position as the offset and advances that with the amount of bytes written.

You supply the function with a buffer, and then the offset position from the buffer start (in bytes) within that buffer to write to, as well as the data type and the value to be written.

 

Syntax:

buffer_poke(buffer, offset, type, value);

ArgumentTypeDescription
bufferBufferThe buffer to use.
offsetRealThe offset position (in bytes) within the buffer to write the given data to.
typeBuffer Data Type ConstantThe type of data that is to be written to the buffer (see the list of constants here).
valueAnyThe data to add to the buffer, in accordance with the type specified.

 

Returns:

N/A

 

Example:

buffer_poke(buff, 3, buffer_u8, colour_get_blue(image_blend));

The above code will add the blue component value of the calling instance's image_blend colour into the buffer stored in the variable buff, at the third position in the buffer as an unsigned 8bit value.