Skip to main content

VoidSentryUltimate

VoidSentryUltimate is a schema-driven buffer serializer for Roblox Luau, optimized for maximum performance. It provides 100+ Types and 10+ Function members.

There is also a pure luau version (LuauVS) for non-roblox environments.

The library strips away unnecessary validation during serialization, minimizes any extra steps (like table allocations, function calls) and contains a lot of cool micro optimizations to make sure it runs as fast as possible.

Basic workflow​

  1. Build a schema from nodes in VoidSentryUltimate.Types.
  2. Serialize a matching value into a buffer.
  3. Send or store that buffer.
  4. Deserialize it with the same schema.

Example​

const VoidSentryUltimate = require(path.to.VoidSentryUltimate)
const Types = VoidSentryUltimate.Types

const PlayerState = VoidSentryUltimate.Schema {
Health = Types.UInt,
Name = Types.String8,
Position = Types.Vector,
}

const Encoded = PlayerState.Serialize {
Health = 100,
Name = "Builder",
Position = Vector3.new(4, 8, 15),
}

const Decoded = PlayerState.Deserialize(Encoded)
print(Decoded.Name, Decoded.Health)

Each Type in VoidSentryUltimate.Types is a SerdesNode. Each SerdesNode is basically a table with:

{
[1] = SerializeFunction, -- function(value, buffer, cursor): cursor
[2] = DeserializeFunction,
... (optional metadata)
}

So if a custom type node is needed, you can do:

const function Ser(Value: any, Buf: buffer, Cursor: number): number
buffer.writeu8(Buf, Cursor, Value.Something)
return Cursor + 1
end

const function Des(Buf: buffer, Cursor: number): (any, number)
return {
Something = buffer.readu8(Buf, Cursor)
}, Cursor + 1
end

const Node = { Ser, Des }

-- You can pass this to VoidSentryUltimate members
const Buf = VoidSentryUltimate.Serialize(Node, { Something = 42 })