Reference

lui is a cross platform gui library for lua, basically a wrapper for libui (https://github.com/andlabs/libui).

Table of contents

Module lui

Functions

errorbox

lui.errorbox(window, title, text)
open a system error message box.

finalize

lui.finalize()
finalize lui and clean up any used resources. May be omitted as lui is finalized when the program terminates.

init

lui.init()
initialize lui, must be called before anything else.

main

lui.main()
enter the main event processing loop.

mainstep

running = lui.mainstep(wait = false)
perform one round of the main event processing loop. Returns true if the program should continue to run, or false if it should quit (i.e. lui.quit() was called).

mainsteps

lui.mainsteps()
initialize your own main loop with lui.mainstep() instead of using lui.main()

msgbox

lui.msgbox(window, title, text)
open a system message box.

onshouldquit

lui.onshouldquit(function)
register a function to be called when the quit menu item (see above) is clicked.

openfile

filename = lui.openfile(window)
open a system file open dialog. Returns the path and name of the file to open, or nil if the dialog was cancelled.

queuemain

lui.queuemain(function)
register a function to be called the next time when there are no events pending. This function will only be called once.

quit

lui.quit()
terminate the main event processing loop. After calling this, lui.main() returns and lui.mainstep() returns false.

savefile

filename = lui.savefile(window)
open a system file save dialog. Returns the path and name of the file to save to, or nil if the dialog was cancelled.

Objects

area

a rendering area for graphics or extended text rendering. Note that all handlers are currently experiments, their arguments may change.

Constructors

area = lui.area(width = 0, height = 0, properties = nil)
create a new area. Setting width and height to a value other than 0 makes the area a scrolling area.

Properties

Methods

box

a container for multiple controls. Automatically arranges contents vertically (for a vbox) or horizontally (for a hbox).

Constructors

Properties

Methods

button

a button control

Constructors

Properties

checkbox

a checkbox control.

Constructors

Properties

colorbutton

a button to open a color selector.

Constructors

Properties

combobox

a combobox control.

Constructors

Properties

Methods

control

Generic UI control methods and properties. All controls have these. In addition, all constructor methods can take a table of properties and associated values as their last argument. If such a table is passed as an argument, those properties are set after the control has been created.

Properties

Methods

datetimepicker

a date / time picker control.

Constructors

Properties

draw.brush

a brush spec to draw with.

Constructors

Properties

draw.context

a drawing context object, passed to area.ondraw handler

Methods

draw.matrix

a transformation matrix for drawing operations

Constructors

Methods

draw.path

a path to draw to a draw.context

Constructors

Methods

draw.strokeparams

a stroke spec to draw with

Constructors

Properties

editablecombobox

an editable combobox control.

Constructors

Properties

Methods

entry

an entry control.

Constructors

Properties

fontbutton

a button to open a font selector.

Constructors

Properties

form

a container, which arranges its children vertically and aligns the labels and controls.

Constructors

Properties

Methods

grid

a container, which arranges its children in a grid.

Constructors

Properties

Methods

group

a labelled container control.

Constructors

Properties

Methods

label

a label control.

Constructors

Properties

a menu for a window. All menus must be created before the window they should be attached to. Once a window with menus has been created, you can not create any more menus for other windows. This is not a control, so it does not have the standard control methods and properties.

Constructors

Methods

a single menu item, as returned by the menu:append*() methods. This is not a control, so it does not have the standard control methods and properties.

Properties

multilineentry

a multiline entry control

Constructors

Properties

Methods

progressbar

a progressbar control.

Constructors

Properties

radiobuttons

a radiobuttons control.

Constructors

Properties

Methods

separator

a separator control

Constructors

slider

a slider control.

Constructors

Properties

spinbox

a spinbox control.

Constructors

Properties

tab

a container whose children are arranged in individual tabs.

Constructors

Properties

Methods

text.attributedstring

a string with formatting attributes, that can be used to create a textlayout object

Constructors

Properties

Methods

text.font

a font to draw text into an area with.

Properties

text.layout

a font to draw text into an area with.

Constructors

Properties

window

Constructors

Properties

Methods