Qt signals can be connected to Lua functions using qt.connect(...).

For instance, the clause

  qt.connect(qobject,'mysignal(QByteArray)',
             function(s) print("mysignal("..s..")") end)
ensures that the specified lua function is called whenever the signal with signature mysignal(QByteArray) is emitted. Arguments with string types are converted to Lua strings, and arguments numerical types are converted to Lua numbers.

Functions passed to qt.connect can of course be closures:

  local table = some_lua_object()
  qt.connect(qobject,'mysignal(QByteArray)',
             function(s) table:mysignalemitted(s) end)

A rather complicated issue is to determine when functions connected to Qt signals are invoked.

Function qt.doevents() can be called anytime to process all pending Qt events and invoke all functions associated with queued signals.