3.1 QtLua lua libraries

QtLua comes with two lua libraries: some general purpose global lua functions useful when running lua script from the QtLua environment, and a Qt library which give access to Qt essential functions.

3.1.1 Predefined lua functions  

The QtLuaLib library contains the following lua functions:

  • The print() lua function prints all passed values using the State::output signal.

  • The list() lua function prints list of members of given table or global table if no argument.

  • The each() lua function returns a lua iterator which can be used to iterate over lua tables and QtLua UserData objects.

  • The help() lua function can be used to display help about Function based objects.

  • The plugin() function returns a Plugin object loaded from given plugin bare file name.

3.1.2 Wrapped Qt functions  

The QtLib library contains some wrapped Qt functions and objects:

  • The qt.connect() and qt.disconnect() functions manage signals and slots connections, see Dynamic signals and slots.

  • The qt.dialog table contains all functions needed to display Qt dialogs.

  • The qt.load_ui() function returns a Qt user interface file loaded using the QUiLoader::load function.

  • The qt.menu table contains functions to manage Qt menus.

  • The qt.meta table contains all wrapped Qt meta objects, useful to access Qt enums and other meta data without QObject instance.

  • The qt.new_widget() function returns a new widget of given class name using the QUiLoader::createWidget function.

The help function can be used to display usage information on all functions in this library:

>> help(qt.connect)
usage: qt.connect(qobjectwrapper, "qt_signal_name", qobjectwrapper, "qt_slot_name")
qt.connect(qobjectwrapper, "qt_signal_name", lua_function)

Valid XHTML 1.0 StrictGenerated by diaxen on Sun Jan 8 22:46:02 2012 using MkDoc