Skip to content
OliverF edited this page Jun 12, 2014 · 1 revision

Sets up a callback to be executed when a message is received from the remote client.

Syntax

nil RSAS.Networking.Hook(string id, function callback)

Returns

  1. nil

Arguments

  1. string id
    Identification string of the message to be received.
  2. function callback
    The function to be called upon reception of a message with the specified identification string. The function is supplied a single argument: a table containing the received message

Example

Client:

local data = {}
data.animal = "cat"
data.tail = true
data.legs = 7

--create a sub-table
local catIdentity = {}
catIdentity.name = "Tom"
catIdentity.type = "tabby"

--add sub-table to data table
data.identity = catIdentity

RSAS.Networking.SendTable("demo_newanimal", data)

Server:

RSAS.Networking.Hook("demo_newanimal", function(data)
    RSAS.Print(data)
end)

Clone this wiki locally