Skip to main content

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.

ByteNet Max serializes your Lua values into compact binary buffers before they travel over the network. Primitive types are the building blocks of that system — each one maps to a specific Lua or Roblox type and occupies a fixed number of bytes (or, in the case of string, a length-prefixed variable amount). Understanding which type to reach for helps you keep packets as small as possible.

Usage example

The snippet below shows the most commonly used primitive types composed together inside a struct:
local ByteNetMax = require(path.to.ByteNetMax)

return ByteNetMax.defineNamespace("Example", function()
    return {
        packets = {
            PlayerUpdate = ByteNetMax.definePacket({
                value = ByteNetMax.struct({
                    health   = ByteNetMax.uint8,   -- 0–255
                    position = ByteNetMax.vec3,    -- 12 bytes
                    isAlive  = ByteNetMax.bool,    -- 1 byte
                    name     = ByteNetMax.string,  -- variable length
                }),
            }),
        },
    }
end)
Use uint8 for values that fit in the 0–255 range (health, level, team ID). Prefer float32 over float64 for positions and other game-world coordinates — it uses 4 bytes instead of 8 and the precision is sufficient for Roblox’s coordinate scale.

Type reference

TypeMaps toRangeSize
uint8number0 – 2551 byte
uint16number0 – 65,5352 bytes
uint32number0 – 4,294,967,2954 bytes
int8number-128 – 1271 byte
int16number-32,768 – 32,7672 bytes
int32number-2,147,483,648 – 2,147,483,6474 bytes
float32number±3.4 × 10³⁸ (32-bit IEEE 754)4 bytes
float64number±1.8 × 10³⁰⁸ (64-bit IEEE 754)8 bytes
Use unsigned types (uint*) for naturally non-negative values. Use int* when the value can be negative. float32 covers almost all game-world use cases; reserve float64 for values that require higher precision.
TypeMaps toSize
stringstring2-byte length header + N bytes for content
boolboolean1 byte (stored as uint8: 1 = true, 0 = false)
nothingnil0 bytes (no data written or read)
unknownunknownVariable — falls back to reference/unknown behavior
buffbufferVariable
nothing is useful as the value type of a packet that carries no payload — it signals intent without wasting bytes. unknown and buff are rarely used directly; prefer explicit types wherever possible.
TypeMaps toSize
vec2Vector28 bytes (two float32 components)
vec3Vector312 bytes (three float32 components)
color3Color33 bytes (R, G, B each as uint8 in 0–255)
cframeCFrame24 bytes (position + axis-angle rotation, six float32 values)
instInstanceVariable — transmitted as a reference
cframe encodes position (X, Y, Z) and rotation as an axis-angle pair so a full transform fits in 24 bytes. color3 quantizes each channel to 8 bits, which is sufficient for all standard Roblox color values.
TypeAlias forMaps toSize
playerNamestringstring2-byte header + N bytes
playerIdentifieruint8number1 byte
playerName and playerIdentifier are convenience aliases — they are wire-identical to string and uint8 respectively. They exist to make packet definitions more self-documenting when a field specifically represents a player’s display name or a compact per-session player ID.

Build docs developers (and LLMs) love