buffer_sizeof

This function returns the size (in bytes) of the given Buffer Data Type Constant (listed here).

NOTE The compiler may replace a call to this function with its value at compile-time when it detects that the value is constant.

 

Syntax:

buffer_sizeof(type);

ArgumentTypeDescription
typeBuffer Data Type ConstantThe type of data to be checked (see the list of constants here).

 

Returns:

Real

 

Example:

var _bytesize = 12 * buffer_sizeof(buffer_u8);
buff = buffer_create(_bytesize, buffer_fixed, 1);

The above code first calculates the size of the buffer to create by multiplying the unsigned 8bit data type by 12 (since we'll be using the buffer to hold 12 pieces of data, each 1 byte in size), and then uses this value to set a fixed buffer to the correct size.