I’ve been trying to use a buffer to store user ids in an unsigned 32 bit buffer. But the outputted result(using readu32) is one of my numbers being multiplied by a 16-bit integer, and the other by an 8-bit integer, and the final one being the correct number.
I’ve tried looking for answers, but buffers are so new, and so unused, that I can’t find anything on online.
Am I stupid, or are buffers stupid?
This is a an example of what i’m trying to do here:
Currently, i’m only putting the number 1 in each buffer to show the raw numbers. But if I instead use zero, they all result in zero(which is good). But if I use 2, then, the integers just multiply by in inputted number.
local exampleBuffer = buffer.create(6) -- any lower than 6 and the script will throw an error(buffer access out of bounds)
buffer.writeu32(exampleBuffer,0,1) -- writing 32 bit for the actual numbers i'll be using
buffer.writeu32(exampleBuffer,1,1)
buffer.writeu32(exampleBuffer,2,1)
buffer.readu32(exampleBuffer,0) -- 65793 | awfully close to the max 16-bit integer(65,536)
buffer.readu32(exampleBuffer,1) -- 257 | also awfully close to the max 8-bit integer(256)
buffer.readu32(exampleBuffer,2) -- 1 | the correct output
Finally, if you have any good sources to learn more about buffers, please link them below!
Thank you for your time, Robocat.