ReferenceRakNet

RakNetPacket.Size

Reads current packet length in bytes. Changes to outgoing data update this value.

Syntax

packet.Size: number

Also available as

RakNetPacket.LengthRakNetPacket.length

Returns

TypeDescription
numberCurrent packet length in bytes. Changes to outgoing data update this value.

Description

Packet metadata properties are read-only. Read the value inside the hook, and retain a byte copy when you need data afterward. Direct assignment to a packet property raises an error.

Example

local function inspect(packet)
    local value = packet.Size
    print(value)
end
raknet.addsendhook(inspect)
task.delay(5, function() raknet.removesendhook(inspect) end)

These are Game executor contracts. Check build requirements and session lifetimes before using them.