LGI Core Reference

Core

Core LGI functionality is accessible through lgi module, loaded by require 'lgi' command. LGI does not install itself into global namespace, caller has to use the return value from require call.

Loads requested module of the latest version found into the repository.

Loads requested module with specified version into the repository.

GObject basic constructs

GObject.Type

Constants containing type names of fundamental GObject types.

Functions for manipulating and querying GType. THey are direct mappings of g_type_xxx() APIs, e.g. GObject.Type.parent() behaves in the same way as g_type_parent() in C.

GObject.Value

Creates new GObject.Value of specified type, optionally assigns Lua value to it. For example, `local val = GObject.Value(GObject.Type.INT, 42)` creates GValue of type G_TYPE_INT and initializes it to value 42.

GObject.Closure

Creates new GClosure instance wrapping given Lua callable. When the closure is emitted, target function is invoked, getting GObject.Value instances as arguments, and expecting single GObject.Value to be returned.