ReferenceRakNet

RakNetPacket:SetData

Replaces the bytes of a live outgoing packet.

Syntax

packet:SetData(data: string | buffer | {number}) -> ()

Parameters

ParameterTypeDescription
datastring, buffer or byte arrayComplete valid replacement packet.

Description

The operation is valid only inside its outgoing hook. The replacement must be nonempty; byte arrays contain integers from 0 through 255. Size and the byte-view properties reflect the new data. This cannot alter received snapshots, and it does not validate a replacement against the game’s protocol.

Example

local function replaceInControlledTest(packet, validReplacement)
    packet:SetData(validReplacement)
end

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