The QtLua library aims to make Qt4 applications scriptable using the Lua scripting language. It 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.
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 classes are provided to expose various script objects to user. The QtLua::ItemModel class enable development of hierarchical C++ data structures accessible from both lua script and Qt view widgets whereas QtLua::TableTreeModel and QtLua::TableGridModel classes can be used to display and edit lua tables in Qt views.
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.
The library has been successfully tested with lua versions from 5.0 to 5.1 and with Qt versions from 4.2 to 4.5.
Releases can be downloaded here.
The project is hosted at https://savannah.nongnu.org/projects/libqtlua .
Source code can be retrieved using subversion:
svn co svn://svn.savannah.nongnu.org/libqtlua/trunk/libqtlua
The QtLua library comes with many examples and detailed documentation.
The user manual is available here.
An other version of the manual with library internal details is available here.
The libqtlua-list mailing list is available for discussing QtLua.
The QtLua library has been developed by Alexandre Becoulet. You can contact the author at: alexandre.becoulet (at) free.fr. Don't forget to include the "qtlua" string somewhere in your message to avoid being filtered.
Generated by diaxen on Tue Jan 26 19:46:00 2010 using MkDoc