Program qlua is a Qt program composed of three objects working independently in separate threads.

Running the Lua interpreter in a separate thread lets the main thread handle user interaction at all times. Windows are refreshed and user interfaces remain active while a Lua program is running.

At times the Lua code needs to act on objects living in another thread. Potential synchronization problems are avoided using the "thread hopping" technique which allows the execution of a Lua function in the target thread. When the function returns, the Lua thread resumes the normal execution of the Lua code. Thread hopping happens automatically when invoking a method defined by a Qt object. Thread hopping can also be performed manually using functions qt.qcall or qt.xqcall.