Module LuaIrLink

Client library for Interaction Router (IR).

Functions

Callback (name, callback) Adds a callback.
Connect (address, port, callback) Connects to a given IR server.
IRLink (ip, port, proxyType) Constructs an IRLink object.
SendCommand (command, callback) Sends a command to the IR.


Functions

Callback (name, callback)
Adds a callback. A callback is a function that can be called from the IR.

Parameters

  • name: the name of the callback.
  • callback:

Usage:

irlink:Callback("foo", function() end)
Connect (address, port, callback)
Connects to a given IR server.

Parameters

  • address: the IP address of the IR to connect to.
  • port: the port the IR is listening on.
  • callback: a function to be called when the connection is established.

Usage:

link:Connect("192.168.23.217", 12345, function() end)
IRLink (ip, port, proxyType)
Constructs an IRLink object.

Parameters

  • ip: the IP address on which we are listening.
  • port: the port we are listening on.
  • proxyType: the kind of proxy we are (i.e. IMPROXY).

Usage:

local link = LuaIrLink.IRLink("192.168.23.217", 10123, "IMPROXY")

Return value:

an IRLink object.
SendCommand (command, callback)
Sends a command to the IR. All commands expect a response.

Parameters

  • command: a table with the data to send in the message. It must have a field named "command" with the name of the command being sent.
  • callback: an optional function that will be called when the response arrives.

Usage:

irlink:SendCommand({ command = "Test", foo = "bar"}, function() ... end)

Valid XHTML 1.0!