{"id":"bajsucks/bufferizer","name":"bufferizer","scope":"bajsucks","platform":"roblox","description":"Mirrored from the Wally registry.","version":"0.1.3","latest":"0.1.3","versions":["0.1.0","0.1.1","0.1.2","0.1.3"],"license":"Apache-2.0","licenseRating":"safe","licenseCaveats":["Modified files must carry a notice of changes. If the package ships a NOTICE file, its attributions must be preserved.","License identified from the packaged LICENSE file; the manifest declared none."],"licenseVerified":true,"dependencies":{},"integrity":"52b1a5d3fa5b492e62d22bb6d347ea04a11de66fbe09ccc71582cfc48f8b5895","likes":0,"downloads":0,"install":"forest install bajsucks/bufferizer","url":"https://forest.dev/p/roblox/bajsucks/bufferizer","files":"https://api.forest.dev/ai/package/roblox/bajsucks/bufferizer/files","readme":"# Bufferizer\r\n\r\nLight, zero-dependency Luau SerDes library for homogeneous arrays.\r\n\r\nInstall with Wally: Add \"bajsucks/bufferizer@^0.1.0\" to your wally.toml and run `wally install`.\r\n\r\nInstall manually: Download the latest .rbxm release from Releases, or build from source via `rojo build`\r\n\r\n## Use cases\r\n- Networking and replication (especially ECS)\r\n- Data saves, I guess?\r\n\r\n## Usage\r\n```luau\r\nBufferizer.Encode<T>(Payload: {T}, Schema: Schema<T>): buffer\r\nBufferizer.Decode<T>(buffer, Schema: Schema<T>): {T}\r\nBufferizer.schemas: {Schema<any>} -- out-of-the-box schemas\r\nBufferizer.primitives.types: {any} -- primitive number types (u8, i16, f32, etc.)\r\n```\r\n\r\nOut-of-the-box schemas:\r\n- `Vector2`\r\n- `Vector3`\r\n- `CFrame`\r\n- `Color3`\r\n- `UDim`\r\n- `UDim2`\r\n- `number` (f64)\r\n- `jecs_id` (i24)\r\n\r\n\r\n## Defining new schemas\r\nIf you want a custom type, you will have to create a schema.\r\nFor example, Vector3 schema:\r\n```luau\r\n-- p = Bufferizer.primitives.types\r\nBufferizer.Schema(\r\n\t{ p.f32, p.f32, p.f32 }, -- `map`, maps the primitives returned by `encode`\r\n\tfunction(v: Vector3) -- `encode`, converts the type into primitives\r\n\t\treturn v.X, v.Y, v.Z\r\n\tend,\r\n\tVector3.new -- `decode` converts the primitives back into the type\r\n)\r\n```\r\nIt's as simple as that!\r\n\r\nYou can also skip encode/decode for pure primitives:\r\n```luau\r\n-- p = Bufferizer.primitives.types\r\nBufferizer.Schema( -- Luau number\r\n\t{ p.f64 },\r\n)\r\n```","readmeTruncated":false}