[V 1.4.0] BinBuffer | Buffering module

:high_voltage: BinBuffer - Easy to use buffering / serialization library

Easy to use | High Perfomance | Buffering | Serialization

Get BinBuffer | GitHub | Docs

:thinking: Why BinBuffer?

  • Easy to use API that’s intuitive and easy to use
  • Beautiful developer experience that just makes sense
  • High Perfomance

:rocket: Quick start

Get module from Creator Marketplace and you’re ready in 2 minutes

local BinBuffer = require(path.to.BinBuffer)

local my_buffer = BinBuffer.create({
   size = BinBuffer.bytes(10), -- <- initial size, grows automatically
})

BinBuffer.writers.addString(my_buffer, "This is a string")
BinBuffer.writers.addNumber(my_buffer, 4)-- automatic type: Uint8
BinBuffer.writers.addVector2F24(my_buffer, Vector2.new(34, 10))

print(BinBuffer.read(my_buffer)) -- {[1] = "This is a string", [2] = 4, [3] = 34, 10} 

BinBuffer.clear(my_buffer) -- <- clears buffer but not destroys
BinBuffer.destroy(my_buffer) -- <- destroy buffer when you dont need a buffer

local my_basic_buffer = buffer.create(10) -- <- basic buffer
buffer.writeu8(my_basic_buffer,  0, BinBuffer.NUMBER_U16) -- <- marker for BinBuffer

buffer.writeu16(my_basic_buffer,  1, 999) -- <- value

local bin_buffer_object = BinBuffer.fromBuffer(my_basic_buffer)
print(BinBuffer.read(bin_buffer_object)) -- <- {[1] = 999}

:thinking: But… But… Wait , Why BinBuffer if we have buffer library by roblox?

  • Easy to use api for begginers
  • many luau types supports in BinBuffer
  • idk what else to say lol

Which types BinBuffer suppots :thinking:

Uint8, Uint16, Uint32, Int8, Int16, Int32, Float16, Float24, Float32, double(Float64),STRING, BOOL, VECTOR3, VECTOR2, CFRAME, COLOR3, UDim, UDim2,
RECT, NUMBER_RANGE, NUMBER_SEQUENCE, COLOR_SEQUENCE, BRICK_COLOR, INSTANCES, TABLES, VECTOR2F16, VECTOR2F24, VECTOR2I16, VECTOR3F16, VECTOR3F24, VECTOR3I16, CFRAMEF16U8, CFRAMEF24U16, CFRAMEF24U8, CFRAMEF24U8


:warning: THIS LIBRARY IS NOT PERFECT, PLIS REPORT ANY BUGS, ITS HARD TO FIX :sob:

U WILL USE BINBUFFER ???
  • YES
  • NAH
  • “buffer acces out of bounds” still using basic buffer library💀
  • maybe, maybe
0 voters
2 Likes

V 1.1.0

:construction: THIS MODULE IS NOT PERFECT PLEASE REPORT ANY BUGS, ITS HARD TO FIX :sob:

Changelog:

  • Removed ‘Add’ function, replaced with custom functions without autotypes, for example AddVector2

  • More compile time code which improves perfomance

  • Refactored many code

V 1.2.0

:construction: THIS MODULE IS NOT PERFECT PLEASE REPORT ANY BUGS, ITS HARD TO FIX :sob:

Changelog:

  • Added many position types:

  • AddCFrameF16U8, AddCFrameF16U16, AddCFrameF24U8, AddCFrameF24U16

  • AddVector2F16, AddVector3F16, AddVector2F24, AddVector3F24, AddVector2I16, AddVector3I16

  • Property table:

Name Bytes Max Angle
CFrameF16U8 10 ~1.4
CFrameF16U16 13 ~360
CFrameF24U8 13 ~1.4
CFrameF24U16 16 ~360
CFrame(F32) 19 any
Vector2F16 5 None
Vector3F16 7 None
Vector2F24 7 None
Vector3F24 10 None
Vector2I16 5 None
Vector3I16 7 None
Vector(F32) 13 None

Why is BinBuffer._buffer a private member? Isnt the entire point of a serde lib to only use the primitive buffer to save space

1 Like

seems like a module made with ai (like the entire post screams edited ai text)

I wont argue with you, if you think so, then ok, but know that AI is dumber than my frying pan in the kitchen (fr)

I created BinBuffer to make working with the buffer library more convenient, I think Ill make it more lower level in new versions

Yes, but at the end youre supposed to be able to use the buffer itself once youve wrote to it so you can actually use it :V Also there should be BinBuffer.fromBuffer() as a constructor

1 Like

V 1.3.0

:construction: THIS MODULE IS NOT PERFECT PLEASE REPORT ANY BUGS, ITS HARD TO FIX :sob:

Changelog:

  • Refactored all module code from OOP paradigm to functional for perfomance reasons

  • Added new functions:

    • fromBuffer

    • tobuffer

    which allow create/export BinBuffer object from/to basic buffer

:warning:WARN: frombuffer function does not support deep tables

V 1.4.0 :happy1:

Changelog:

  • Function alloc now public

  • Added docs

  • Added more lower-level functions with no automatic classification