Invoking Packet Functions
Packet Functions return a Promise when invoked.
This allows the caller to asynchronously wait for the response without blocking execution.
Invoking a Server Function
Section titled “Invoking a Server Function”Server-owned functions are invoked from the client.
Example:
Network.Server.RequestData:Invoke(nil, { id = 123}):andThen(function(result) print(result.name) print(result.score)end)The Promise resolves when the server callback returns a value.
Invoking a Client Function
Section titled “Invoking a Client Function”Client-owned functions are invoked from the server.
Example:
Network.Client.GetPing:Invoke(player):andThen(function(ping) print(ping)end)Handling Results
Section titled “Handling Results”Since PacketFunctions use Promises, You can use Promise methods to handle results:
Network.Server.RequestData:Invoke(nil, data):andThen(function(result) -- handle on successend):catch(function(err) -- handle on errorend)