Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Elitriare/ByteNet-Max/llms.txt
Use this file to discover all available pages before exploring further.
ByteNetMax.auto is a flexible catch-all data type for when you want to send a value without committing to an exact type at definition time. Instead of encoding structure up front, auto inspects the value at send-time, writes a 1-byte type marker, and then serializes the value using the most compact matching codec. On the receiving end, the marker is read first, the correct codec is selected, and the original value is reconstructed — all transparently.
How it works
Every call to.send() on an auto packet writes exactly one extra byte — the type ID — before the payload. The serializer then picks the best-fit codec for the runtime value:
- Integers use the smallest fitting unsigned or signed type (
uint8,uint16,uint32,int8,int16,int32). - Floats that round-trip losslessly through a 32-bit buffer use
float32; anything else falls back tofloat64. - Roblox types (Vector2, Vector3, Color3, CFrame) use their fixed-size codecs.
- Strings use the standard 2-byte length-prefixed encoding.
- nil and boolean have dedicated single-byte codecs.
- Anything else (Instance, buffer, custom userdata) falls back to the
unknown/reference codec.
Supported types and type IDs
| Type ID | Lua/Roblox type | Codec used |
|---|---|---|
| 0 | nil | No payload written |
| 1 | boolean | bool (1 byte) |
| 2 | number (0–255, integer) | uint8 (1 byte) |
| 3 | number (256–65,535, integer) | uint16 (2 bytes) |
| 4 | number (65,536–4,294,967,295, integer) | uint32 (4 bytes) |
| 5 | number (-128–127, integer) | int8 (1 byte) |
| 6 | number (-32,768–32,767, integer) | int16 (2 bytes) |
| 7 | number (-2,147,483,648–2,147,483,647, integer) | int32 (4 bytes) |
| 8 | number (fits float32 exactly) | float32 (4 bytes) |
| 9 | number (all remaining) | float64 (8 bytes) |
| 10 | string | string (2-byte header + N bytes) |
| 12 | Vector2 | vec2 (8 bytes) |
| 13 | Vector3 | vec3 (12 bytes) |
| 14 | Color3 | color3 (3 bytes) |
| 15 | CFrame | cframe (24 bytes) |
| 17 | anything else | unknown (reference/fallback) |
Number selection logic
For integer values,auto checks ranges in order from smallest to largest. Positive integers are tested against unsigned types first; negative integers skip straight to signed types:
Defining a packet with auto
Sending values
auto packet on different calls.
auto adds exactly 1 byte of overhead per value for the type marker. This cost is paid on every send, regardless of which codec is selected for the payload.