Bool
Type<boolean>
One byte:
1 for true, 0 for false.A full byte per boolean, because there is no bit-packing. Eight flags cost eight bytes. If
you send many booleans together, pack them into a
T.UInt8() bitfield yourself:Read returns value == 1, so any byte other than 1 decodes as false.String
Type<string>
A varint length prefix followed by the raw bytes.
number
Optional maximum byte length, asserted on write.
Size
The varint prefix is one byte up to 127, two up to 16,383, and three up to 2,097,151.
Strings are written with
buffer.writestring, so they are byte sequences rather than
character sequences. Binary data is safe, and maxLen counts bytes, not characters. A UTF-8
emoji costs four against the limit.The maxLen bound
Any
Type<any>
Falls back to the dynamic
WriteAny and ReadAny encoder for this one entry.T.Any() costs a type tag byte plus the value, which is exactly what an unschematised
argument costs. It is the escape hatch rather than an optimisation: an event that is all
T.Any() entries is byte-for-byte identical to one with no schema, just more verbose.Types has no constructor for:
Next steps
Roblox datatypes
Vectors, CFrames, instances and enums.
Composites
Nesting types into arrays and structs.
