Examples
Basic Usage
Built-in Functions
ByteWorks provides two convenient functions, createAndSerialize and resultExcludingCursor, to simplify serialization and deserialization, at the cost of a minimal performance overhead.
--define a serializer for a vector3 with each axis using a f32
local vector3Type = ByteWorks.vector3(ByteWorks.f32)
--create buffer from the serializer type and data
local vector = Vector3.new(1, 2, 3)
local buff = ByteWorks.createAndSerialize(vector3Type, vector)
--extract the data from the buffer
local deserializedVector = ByteWorks.resultExcludingCursor(vector3Type, buff, 0)
print(deserializedVector) --> 1, 2, 3