The QtLua library is an alternative to the QtScript module.
QtLua does not generate or use generated binding code for Qt. Instead it provides useful C++ wrapper classes to make C++ and lua objects accessible from both lua and C++. It takes advantages of the Qt meta object system to expose QObject members to lua scripts.
QtLua library has been successfully tested with lua versions from 5.0 to 5.1 and with Qt versions from 4.2 to 4.5.
Here are some key features of "QtLua library":
· The lua stack-based C API is not exposed, only C++ objects like QtLua::State and QtLua::Value are manipulated from C++ code.
· Lua values can be accessed from C++ with almost the same straightforward syntax as in lua through C++ operator overloading.
· C++ objects can be exposed to lua as userdata values by inheriting from the QtLua::UserData class. All lua meta operations can be redefined by overriding virtual functions, including iteration over userdata objects from lua. The QtLua::Ref smart pointer class enables QtLua::UserData based objects reference tracking and can make these objects subject to lua garbage collection.
· The QtLua::Iterator wrapper class enables use of usual C++ iterators to traverse lua tables and userdata values. Lua iterators can also be used to traverse Qt containers and C++ QtLua::UserData based objects from lua.
· Qt QObject wrapping enables creation and manipulation of QObjects and loading of .ui user interface files from lua, this allows writing some part of the user interface in lua. QObject properties, enumerations, slots and children objects can be accessed from lua. Qt Signals can be connected directly to lua functions.
· The QtLua::Plugin class allows easy writing of Qt plugins which may contains QtLua::Function objects invocable from lua.
· Qt Model/View base classes are provided to easily develop hierarchical data structures accessible from both lua script and Qt view widgets.
· Qt template containers can be exposed to lua script with just a proxy template classes instantiation.
· The library comes with the Qt QtLua::Console widget: a console widget with history and lua table completion capabilities.
· The qtlua tool can be used to execute and test Qt based lua scripts or play with Qt objects from lua in an interactive manner through a Qt console widget interface.