LuaRemote

class LuaRemote
add_interface(name, functions) Add a remote interface.
call(interface, function, ...) Call a function of an interface.
interfaces :: dictionary stringdictionary stringboolean [R] List of all registered interfaces.

Registry of interfaces between scripts. An interface is simply a dictionary mapping names to functions. A script or mod can then register an interface with LuaRemote, after that any script can call the registered functions, provided it knows the interface name and the desired function name. An instance of LuaRemote is available through the global object named remote.

Example
Will register a remote interface containing two functions. Later, it will call these functions through remote.
remote.add_interface("human interactor",
                     {hello = function() game.local_player.print("Hi!") end,
                      bye = function(name) game.local_player.print("Bye " .. name) end})
-- Some time later, possibly in a different mod...
remote.call("human interactor", "hello")
remote.call("human interactor", "bye", "dear reader")
add_interface(name, functions)

Add a remote interface.

Parameters
name :: string: Name of the interface.
functions :: dictionary stringfunction: List of functions that are members of the new interface.
Note: There is currently no way of unregistering an interface.
Note: It is not an error if the given interface name is already registered. However, LuaRemote::call will always only consider the earlier-registered interface, making it impossible to actually use the later interface. Combined with the inability to unregister interfaces, re-using interface names may not be a very recommendable practice.
call(interface, function, ...)

Call a function of an interface.

Parameters
interface :: string: Interface to look up function in.
function :: string: Function name that belongs to interface.
...: Arguments to pass to the called function.
interfaces :: dictionary stringdictionary stringboolean [Read-only]

List of all registered interfaces. For each interface name, remote.interfaces[name] is a dictionary mapping the interface's registered functions to the value true.

Example
Assuming the "human interactor" interface is registered as above
game.local_player.print(tostring(remote.interfaces["human interactor"]["hello"]))        -- prints true
game.local_player.print(tostring(remote.interfaces["human interactor"]["nonexistent"]))  -- prints nil