# signal

The Lua event handler for interstate & C++ calls.
You can use this to contact other lua_State objects, make calls to C++, or have C++ make calls to you.
Some libraries will have a Signal section to let you know of events they have, the functions here are for those libraries.


# Lua Functions

This is strictly for Lua based calls without a C++ counterpart.
Supports interstate functionality, so that you can make calls to other lua_State threads.

local state = reflection.open("example")

reflection.execute([[
signal.add("test", "example", function(...)
    print(...)
end)
]], "example_name", state)

signal.call(state, "test", "hello world") -- print on example lua_State: [example] hello world

# signal.add(name: string, identity: string, callback: function)

signal.add(name: string, identity: string, callback: function)
  • Adds a function to an signal, this will call the callback when C++ invokes it

# signal.remove(name: string, identity: string)

signal.remove(name: string, identity: string)
  • Removes a function from a signal

# signal.get(name: string, identity: string): function?

signal.get(name: string, identity: string): function?
  • Attempts to retrieve a function from the signal callbacks

# signal.call(state: lua_State, name: string, ...any): ...any

signal.call(state: lua_State, name: string, ...any): ...any
  • Calls events on a lua_State
  • Must have the same matching name for them to actually call

# signal.connect(name: string, callback: function, identity: string)

signal.connect(name: string, callback: function, identity: string)
  • Same as signal.add(name: string, identity: string, callback: function)
  • Different call style under the RBLX standard

# signal.disconnect(name: string, identity: string)

signal.disconnect(name: string, identity: string)
  • Same as signal.remove(name: string, identity: string)
  • Different call style under the RBLX standard

# signal.connection(name: string, identity: string): function?

signal.connection(name: string, identity: string): function?
  • Same as signal.get(name: string, identity: string): function?
  • Different call style under the RBLX standard

# signal.fire(state: lua_State, name: string, ...any): ...any

signal.fire(state: lua_State, name: string, ...any): ...any
  • Same as signal.call(state: lua_State, name: string, ...any): ...any
  • Different call style under the RBLX standard

# Library Functions

These exists on libraries that have events or invokers, you can use these to talk to C++

# signal.add(name: string, identity: string, callback: function)

signal.add(name: string, identity: string, callback: function)
  • Adds a function to an signal, this will call the callback when C++ invokes it

# signal.remove(name: string, identity: string)

signal.remove(name: string, identity: string)
  • Removes a function from a signal

# signal.get(name: string, identity: string): function?

signal.get(name: string, identity: string): function?
  • Attempts to retrieve a function from the signal callbacks

stub signal.call(name: string, ...any): ...any

  • Useful under conditions where C++ has multiple functions for a single purpose
  • Depends on the C++ developer's implementation

# signal.connect(name: string, callback: function, identity: string)

signal.connect(name: string, callback: function, identity: string)
  • Same as signal.add(name: string, identity: string, callback: function)
  • Different call style under the RBLX standard

# signal.disconnect(name: string, identity: string)

signal.disconnect(name: string, identity: string)
  • Same as signal.remove(name: string, identity: string)
  • Different call style under the RBLX standard

# signal.connection(name: string, identity: string): function?

signal.connection(name: string, identity: string): function?
  • Same as signal.get(name: string, identity: string): function?
  • Different call style under the RBLX standard

stub signal.fire(name: string, ...any): ...any

  • Same as signal.call(name: string, ...any): ...any
  • Different call style under the RBLX standard