LGI

LGI is gobject-introspection based dynamic Lua binding to GObject based libraries. It allows using GObject-based libraries directly from Lua.

Licensed under MIT-style license, see LICENSE file for full text.

Home of the project is on GitHub.

LGI is tested and compatible with standard Lua 5.1, Lua 5.2, Lua 5.3 and LuaJIT2. Compatibility with other Lua implementations is not tested yet. Lua 5.4 is only supported experimentally.

If you need to support pre-gobject-introspection GTK (ancient GTK+ 2.x releases), use Lua-Gnome.

Installation:

In order to be able to compile native part of lgi, gobject-introspection >= 0.10.8 development package must be installed, although preferred version is >= 1.30. The development package is called libgirepository1.0-dev on debian-based systems (like Ubuntu) and gobject-introspection-devel on RedHat-based systems (like Fedora).

Using LuaRocks:

luarocks install lgi

Alternatively, use make-based installation:

make
[sudo] make install [PREFIX=<prefix>] [DESTDIR=<destdir>]

Please note that on BSD-systems you may need to use 'gmake'.

Building via Meson is also supported, with the same requirements, plus a Meson installation along with the Ninja build tool, in an empty build directory:

cd $(builddir)
meson $(lgi_srcroot) [--prefix=<prefix>] [--buildtype=<buildtype>] [--pkg-config-path=<pkgconfigpath>] [-Dlua-pc=...] [-Dlua-bin=...]
ninja
ninja test
[sudo] ninja install

Building lgi with Visual Studio 2013 and later is also supported via Meson. It is recommended in this case that CMake is also installed to make finding Lua or LuaJIT easier, since Lua and LuaJIT support Visual Studio builds via batch files or manual compilation of sources. Ensure that %INCLUDE% includes the path to the Lua or LuaJIT headers, and %LIB% includes the path where the lua5x.lib from Lua or LuaJIT can be found, and ensure that lua5x.dll and lua.exe or luajit.exe can be found in %PATH% and run correctly. For building with LuaJIT, please do not pass in -Dlua-pc=luajit, but do pass in -Dlua-bin=luajit in the Meson command line so that the LuaJIT interpreter can be found correctly.

Usage

See examples in samples/ directory. Documentation is available in doc/ directory in markdown format. Process it with your favorite Markdown processor if you want to read it in HTML. You can also check the moonsteal/lua-gtk-examples repository, where you can find a variety of Lua Gtk examples.

Credits

List of contributors, in no particular order:

Many other people contributed to what lgi is today, in many forms - writing patches, reporting bugs, packaging for distributions, providing ideas, spreading a word... Many thanks to all of you!

History

0.9.2 (9-Oct-2017)

0.9.1 (27-May-2016)

0.9.0 (23-Mar-2015)

0.8.0 (02-Jul-2014)

0.7.2 (12-Sep-2013)

0.7.1 (4-Mar-2013)

0.7.0 (23-Feb-2013)

0.6.2 (25-Jun-2012)

- Avoid unexpected dependency on cairo-devel, cairo-runtime is now enough - Make set_resident() more robust and fix stack leak for Lua 5.2 case, avoid useless warning when set_resident() fails (to accommodate for static linking case). - Fix small memory leak (mutex) which occured once per opened lua_State using lgi.

0.6.1 (19-Jun-2012)

- objects and structs: actually implement _type property as documented - tests: Fix regression tests for less common platforms - Pango: Add a few missing overrides - cairo: Fix Context:user_to_device() family of methods. - GStreamer: Add support for transfer!=none for input objects. This is needed to avoid leaks caused by strange usage of transfer annotations of gstreamer-0.10 - GStreamer: Add more missing overrides - GStreamer: Fix and improve samples - Various fixes for usecase when Lua context with loaded lgi is closed and opened again - Gtk: Add missing Gtk.Builder:connect_signals() override

0.6 (22-May-2012)

- Add cairo bindings, cairo sample and finish some gtk-demo parts which were requiring cairo

0.5.1 (not officially released)

- Fix a few problems on more exotic architectures (s390x, mips, ia64). - Allow passing byte.buffer when UTF8 string is requested.

0.5 (15-Apr-2012)

0.4 (4-Jan-2012)

0.3 (28-Nov-2011)

0.2 (7-Nov-2011)

First public release