buffer_poke(buffer, offset, type, value);

参数 描述
buffer The index of the buffer to use.
偏移 The offset position (in bytes) within the buffer to write the given data to.
type The type of data that is to be written to the buffer (see the list of constants here).
The data to add to the buffer, in accordance with the type specified.

Returns: 0 if a success, or one of the constants listed below if a failure:

常量 描述
buffer_generalerror is given when poking to a buffer with a string and the string is empty or the value is not a string
buffer_outofspace is returned when peeking / poking to a buffer beyond its capacity
buffer_outofbounds is when an explicit operation is outside of the buffer capacity (i.e. index is < 0 or > capacity)
buffer_invalidtype is when a non u8 type is used for poking to a fast buffer type.


With the buffer_write function, you can write data to the given buffer at the current "seek" position, with each piece of data advancing this position by the bytes being written or read. However, it may be necessary for you to change a given piece of data without wanting to change the current seek position, and that's when you would use this function. You simply supply the function with a buffer index, 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.


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

The above code will add the blue component value of the colour used for the image blend into the buffer indexed in the variable "buff", at the third position in the buffer and as an unsigned 8bit value.