Skip to content

Network Messages

EntranceJew edited this page Oct 8, 2014 · 4 revisions

General Structure

example_message = {
  chan="example_channel", --string name of the signal "channel", directly corresponds to the callback method name.
  data={ --table of all data values used by the server
    item="hotdog",
    x=3,
    y=4,
  },
  client=networkclientnumber, --int reference to the sender's index in server_peerlist
}
  • chan string is the the message type, or "channel" -- directly corresponds to the callback method used.
  • data table is a table that contains all the data to be used by the callback method.
  • client int is the clientid of the person sending the message, which references their position in the server_peerlist. A clientid of 0 means that the client has not connected previously.

Server -> Client Messages

  • connected is an acknowledgement to the c-s message connect that provides the info necessary for a client to find its place relative to the server.
    • Arguments
    • clientid int is the id the client in server_peerlist.
    • inflives bool is whether or not lives will be limited.
    • sharingportals bool is whether or not all players will share portals.
    • infinitetime bool is whether or not time will be limited.
    • checkboxes table is a table of the server's checkbox values.

Client -> Server Messages

  • connect is the message sent when a client is attempting to connect to the server.
    • Arguments
    • nick string the name that a particular client has chosen for themselves.

Clone this wiki locally