SerializerBuilder
A builder used to make a simple an intuitive serializer at runtime.
Functions
uint32WithName
SerializerBuilder.
uint32WithName
(
valueName:
string
--
The index that this uint32 will have when it is deserialized into a table.
) →
SerializerBuilder
--
The builder instance.
Inserts an action to the deserializer action list, which indicates it to read 4 bytes and treat the return as an unsigned 32 bit integer.
uint16WithName
SerializerBuilder.
uint16WithName
(
valueName:
string
--
The index that this uint16 will have when it is deserialized into a table.
) →
SerializerBuilder
--
The builder instance.
Inserts an action to the deserializer action list, which indicates it to read 2 bytes and treat the return as an unsigned 16 bit integer.
uint8WithName
SerializerBuilder.
uint8WithName
(
valueName:
string
--
The index that this uint8 will have when it is deserialized into a table.
) →
SerializerBuilder
--
The builder instance.
Inserts an action to the deserializer action list, which indicates it to read 1 byte and treat the return as an unsigned 8 bit integer.
int32WithName
SerializerBuilder.
int32WithName
(
valueName:
string
--
The index that this int32 will have when it is deserialized into a table.
) →
SerializerBuilder
--
The builder instance.
Inserts an action to the deserializer action list, which indicates it to read 4 bytes and treat the return as an signed 32 bit integer.
int16WithName
SerializerBuilder.
int16WithName
(
valueName:
string
--
The index that this int16 will have when it is deserialized into a table.
) →
SerializerBuilder
--
The builder instance.
Inserts an action to the deserializer action list, which indicates it to read 2 bytes and treat the return as an signed 16 bit integer.
int8WithName
SerializerBuilder.
int8WithName
(
valueName:
string
--
The index that this int8 will have when it is deserialized into a table.
) →
SerializerBuilder
--
The builder instance.
Inserts an action to the deserializer action list, which indicates it to read 1 byte and treat the return as an signed 8 bit integer.
floatWithName
SerializerBuilder.
floatWithName
(
valueName:
string
--
The index that this float32 will have when it is deserialized into a table.
) →
SerializerBuilder
--
The builder instance.
Inserts an action to the deserializer action list, which indicates it to read 4 bytes and to treat the return as a IEEE-754 single-precision floating point number.
doubleWithName
SerializerBuilder.
doubleWithName
(
valueName:
string
--
The index that this double/float64 will have when it is deserialized into a table.
) →
SerializerBuilder
--
The builder instance.
Inserts an action to the deserializer action list, which indicates it to read 8 bytes and to treat the return as a IEEE-754 double-precision floating point number.
stringWithName
SerializerBuilder.
stringWithName
(
valueName:
string
,
--
The index that this string will have when it is deserialized into a table.
maxStringSize:
number
--
The length of the string, used to cap buffers from becoming too big.
) →
SerializerBuilder
--
The builder instance.
Inserts an action to the deserializer action list, which indicates it to read an arbitrary amount bytes and to treat the return as a string. The size of the string is placed four bytes before the string as an int32.
Errors
Type | Description |
---|---|
"maxStringSize must be a number" | Happens when maxStringSize is not of type number. |
"maxStringSize is too big, serializer will not continue" | Happens when maxSizeString exceeds 1025. |
booleanWithName
SerializerBuilder.
booleanWithName
(
valueName:
string
--
The index that this boolean will have when it is deserialized into a table.
) →
SerializerBuilder
--
The builder instance.
Inserts an action to the deserializer action list, which indicates it to read 1 byte and to treat the return as a boolean.
vectorWithName
SerializerBuilder.
vectorWithName
(
valueName:
string
--
The index that this vector will have when it is deserialized into a table.
) →
SerializerBuilder
--
The builder instance.
Inserts an action to the deserializer action list, which will indicate it to read three IEEE-754 double-precision floating point numbers, representing X, Y and Z for a Vector3.
tableWithName
SerializerBuilder.
tableWithName
(
valueName:
string
,
--
The index that this table will have when it is deserialized into a table.
tableSerializer:
Serializer
<
U
>
--
The serializer that the table will use when being turned from a buffer into a table and vice-versa.
) →
SerializerBuilder
--
The builder instance.
Inserts an action to the deserializer action list, which will indicate it to read an aribitrary amount of bytes determined by the table serializer, and to then feed that into the given serializer to craft the table.
bufferWithName
SerializerBuilder.
bufferWithName
(
valueName:
string
,
--
The index that this buffer will have when it is deserialized into a table.
bufSize:
number?
--
The size the buffer will have. If not specified, the size will be of 0x1000, or 4096 bytes.
) →
SerializerBuilder
--
The builder instance.
Inserts an action to the deserializer action list, which will read the given number of bytes, then it will copy those bytes into a new buffer.