Reader¶
A deserializing utility. Is essentially a wrapper around a Bytes object
Note: Any of the Read...() methods below will throw if the length is exceeded. Objects which start with a 32-bit signed size will throw if the size is negative.
Class Members¶
Reader.new(bytes)¶
Returns
ReaderConstructs a Reader using a specified byte buffer
Instance Members¶
reader.pos¶
Returns
numberThe current position of the reader
Will throw if set position is invalid
reader:seek(advance: number)¶
Seek ahead or backwards (if negative) in the stream
Will throw if final position is invalid.
reader:read_bool()¶
Returns
booleanReads a boolean from the stream and advances the position by
1
reader:read_string()¶
Returns
stringReads a string from the stream and advances the position by
4 + <size>
reader:read_strings()¶
Returns
container<string>Reads several strings from the stream and advances the position by
4 + <count>
reader:read_bytes()¶
Returns
BytesReads a byte buffer from the stream and advances the position by
4 + <size>
reader:read_zdoid()¶
Returns
ZDOIDReads a ZDOID from the stream and advances the position by
12
reader:read_vec3f()¶
Returns
Vector3Reads a Vector3 from the stream and advances the position by
12
reader:read_vec2i()¶
Returns
Vector2iReads a Vector2i from the stream and advances the position by
8
reader:read_quat()¶
Returns
QuaternionReads a Quaternion from the stream and advances the position by
16
reader:ReadProfile()¶
reader:ReadProfile()Returns
UserProfileReads a UserProfile from the stream and advances the position by
16
reader:read_s8()¶
Returns
numberReads an 8-bit signed integer from the stream and advances the position by
1
reader:read_s16()¶
Returns
numberReads a 16-bit signed integer from the stream and advances the position by
2
reader:read_s32()¶
Returns
numberReads a 32-bit signed integer from the stream and advances the position by
4
reader:read_s64()¶
Returns
Int64Reads a 64-bit signed integer from the stream and advances the position by
8
reader:read_u8()¶
Returns
numberReads an 8-bit unsigned integer from the stream and advances the position by
1
reader:read_u16()¶
Returns
numberReads an 16-bit unsigned integer from the stream and advances the position by
2
reader:read_u32()¶
Returns
numberReads an 32-bit unsigned integer from the stream and advances the position by
4
reader:read_u64()¶
Returns
UInt64Reads an 64-bit unsigned integer from the stream and advances the position by
8
reader:read_float()¶
Returns
numberReads a 32-bit floating point number from the stream and advances the position by
4
reader:read_double()¶
Returns
numberReads a 64-bit floating point number from the stream and advances the position by
8
reader:read_char16()¶
Returns
numberReads a variable length UTF8 character from the stream and advances the position by a max of
3