What does settings writebuffer do

what does settings.writebuffer() do

It’s saves a Buffer. Buffers are arrays of bytes; they are mostly used for storing custom data in a very efficient way:

// Creates a buffer that is 8 bytes long
const data = control.createBuffer(8);

// Sets the byte at index 0. A single byte can only
// hold numbers 0-255
data[0] = 123;

// To store bigger numbers, you can use Buffer.setNumber. This writes
// a 64 bit floating point number into the buffer (8 bytes long)
data.setNumber(NumberFormat.Float64LE, 0, 3.14159267)

// You can read numbers out the same way
const pi = data.getNumber(NumberFormat.Float64LE, 0)

In general it’s better to use the number array method instead unless you really need to use this

3 Likes

thanks you