Skip to content

NetMessage

NetMessage is a data type used for transporting data between client and server when using NetworkEvent.

Constructors

NetMessage.New

Creates a new NetMessage instance.

Methods

AddString

Parameters

key [ string ]

value [ string ]

Sets a key as a string.

Limitations

Adding a string longer than 65,535 characters will cause the message to be silently dropped during transmission, and the NetworkEvent will not be fired on the other side.

If you need to send a large string, consider sending it in smaller chunks.

GetString → string

Parameters: key [ string ]

Gets the value of a string key.

AddInt

Parameters

key [ string ]

int [ int ]

Sets a key as an integer.

GetInt → int

Parameters: key [ string ]

Gets the value of an integer key.

AddNumber

Parameters

key [ string ]

number [ float ]

Sets a key as a float.

GetNumber → float

Parameters: key [ string ]

Gets the value of a float key.

AddBool

Parameters

key [ string ]

bool [ boolean ]

Sets a key as a boolean.

GetBool → boolean

Parameters: key [ string ]

Gets the value of a boolean key.

AddVector2

Parameters

key [ string ]

vector2 [ Vector2 ]

Sets a key as a Vector2.

GetVector2 → Vector2

Parameters: key [ string ]

Gets the value of a Vector2 key.

AddVector3

Parameters

key [ string ]

vector3 [ Vector3 ]

Sets a key as a Vector3.

GetVector3 → Vector3

Parameters: key [ string ]

Gets the value of a Vector3 key.

AddColor

Parameters

key [ string ]

color [ Color ]

Sets a key as a Color.

GetColor → Color

Parameters: key [ string ]

Gets the value of a Color key.

AddInstance

Parameters

key [ string ]

instance [ Instance ]

Sets a key as an Instance.

GetInstance → Instance

Parameters: key [ string ]

Gets the value of an Instance key.