Server to Client Byte Format
Null
Byte Format: o
Integer (Example: 15)
Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 |
i | 0f | 00 | 00 | 00 |
Float (Example: 3.14)
Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 |
f | c3 | f5 | 48 | 40 |
Boolean (Example: true)
String (Example: "apple")
Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | Byte 8 |
s | 00 | 05 | 61 | 70 | 70 | 6c | 65 |
s | . | . | a | p | p | l | e |
Vector (Example: (1.0, 2.0, 3.0))
Byte 1 | Bytes 2-5 | Bytes 6-9 | Bytes 10-13 |
v | 00 00 80 3f | 00 00 00 40 | 00 00 40 40 |
Quaternion (Example: (1.0, 2.0, 3.0, 4.0))
Byte 1 | Byte 2-5 | Byte 6-9 | Byte 10-13 | Byte 14-17 |
q | 00 00 80 3f | 00 00 00 40 | 00 00 40 40 | 00 00 80 40 |
Array (Example: [100, 200])
Byte 1 | Bytes 2-5 (L) | Byte 6-10 | Byte 11-15 |
a | 0a 00 00 00 | 69 64 00 00 00 | 69 c8 00 00 00 |
Table (Example: {a=1, b="okay"})
Byte 1 | Bytes 2-5 (L) | Key 1 | Value 1 | Key 2 | Value 2 |
t | 14 00 00 00 | 73 00 01 61 | 69 01 00 00 00 | 73 00 01 62 | 73 00 04 6f 6b 61 79 |
GetRemoteValue (Example: GetRemoteValue("a"))
Byte 1 | Bytes 2-5 (L) | Key |
g | 04 00 00 00 | 73 00 01 61 |
GetRemoteValueEx (Example: GetRemoteValueEx("Console", "Print"))
Byte 1 | Bytes 2-5 (L) | Object | Key |
k | 17 00 00 00 | 67 0a 00 00 00 73 00 07 43 6f 6e 73 6f 6c 65 | 73 00 05 50 72 69 6e 74 |
SetRemoteValue (Example: SetRemoteValue("a", 1.0))
Byte 1 | Bytes 2-5 (L) | Key | Value |
h | 09 00 00 00 | 73 00 01 61 | 66 00 00 80 3f |
SetRemoteValueEx (Example: below)
Format: First byte = 'j'
(0x6B), followed by L
(total byte length of the object, key, and value encodings). The object, key, and value are encoded sequentially according to their types.
Example
Example: Creating and modifying a vector's component on the client side.
Step 1: Creating a Vector on the Client
Command: RemoteExec(SetRemoteValue("a", Vector(1,2,3)), FindPlayer(0))
This will create a vector with coordinates (1, 2, 3) on the client side.
Step 2: Modifying the Y Component of the Vector
Command: RemoteExec(SetRemoteValueEx(GetRemoteValue("a"), "Y", 5), FindPlayer(0))
This updates the Y component of the vector to 5 on the client side.
Byte 1 | Bytes 2-5 (L) | Object | Key | Value |
j |
11 00 00 00 |
67 0a 00 00 00 73 00 01 61 |
73 00 01 59 |
69 05 00 00 00 |
CallRemoteFunc (Example: CallRemoteFunc(GetRemoteValue("rprint"), "Hello"))
Byte 1 | Bytes 2-5 (L) | Function | Parameter 1 |
F | 16 00 00 00 | 67 09 00 00 00 73 00 06 72 70 72 69 6e 74 | 73 00 05 48 65 6c 6c 6f |
CallRemoteFuncEx (No example provided)
Format: First byte = 'E', followed by L, function, environment, and arguments encoded in sequence.
Metamethods for Userdata/Superblob
_add (Addition)
This metamethod allows addition between an object and another operand.
Example:
GetRemoteValue("a") + 5
Byte 1 | Bytes 2-5 (L) | Object | Operand |
+ |
0e 00 00 00 |
67 04 00 00 00 73 00 01 61 |
69 05 00 00 00 |
_sub (Subtraction)
This metamethod allows subtraction between an object and another operand.
Example:
GetRemoteValue("a") - 5
Byte 1 | Bytes 2-5 (L) | Object | Operand |
- |
0e 00 00 00 |
67 04 00 00 00 73 00 01 61 |
69 05 00 00 00 |
_mul (Multiplication)
This metamethod allows multiplication between an object and another operand.
Example:
GetRemoteValue("a") * 5
Byte 1 | Bytes 2-5 (L) | Object | Operand |
* |
0e 00 00 00 |
67 04 00 00 00 73 00 01 61 |
69 05 00 00 00 |
_div (Division)
This metamethod allows division of an object by another operand.
Example:
GetRemoteValue("a") / 5
Byte 1 | Bytes 2-5 (L) | Object | Operand |
/ |
0e 00 00 00 |
67 04 00 00 00 73 00 01 61 |
69 05 00 00 00 |
_modulo (Modulo)
This metamethod calculates the remainder of the division of an object by another operand.
Example:
GetRemoteValue("a") % 5
Byte 1 | Bytes 2-5 (L) | Object | Operand |
% |
0e 00 00 00 |
67 04 00 00 00 73 00 01 61 |
69 05 00 00 00 |
_unm (Unary Minus)
This metamethod changes the sign of the object.
Example:
-GetRemoteValue("a")
Byte 1 | Bytes 2-5 (L) | Object |
u |
09 00 00 00 |
67 04 00 00 00 73 00 01 61 |