What GUI toolkits are available?
This wiki page is a good start. In summary, all the major GUI libraries now have Lua bindings.
Probably the most full-featured and well-maintained binding is wxLua
There is a binding to Tcl/Tk. and also to Qt.
An easy and lightweight alternative for more casual scripting is IUP; both IUP and wxLua are part of Lua for Windows but they are available separately and are available for Unix as well.
Here is a simple plotting program:
require( "iuplua" )
require( "iupluacontrols" )
require( "iuplua_pplot51" )
plot = iup.pplot{TITLE = "A simple XY Plot",
MARGINBOTTOM="35",
MARGINLEFT="35",
AXS_XLABEL="X",
AXS_YLABEL="Y"
}
iup.PPlotBegin(plot,0)
iup.PPlotAdd(plot,0,0)
iup.PPlotAdd(plot,5,5)
iup.PPlotAdd(plot,10,7)
iup.PPlotEnd(plot)
dlg = iup.dialog{plot; title="Plot Example",size="QUARTERxQUARTER"}
dlg:show()
iup.MainLoop()
With the iupx utility functions it can be as simple as this:
require "iupx"
plot = iupx.pplot {TITLE = "Simple Data", AXS_BOUNDS={0,0,100,100}}
plot:AddSeries ({{0,0},{10,10},{20,30},{30,45}})
plot:AddSeries ({{40,40},{50,55},{60,60},{70,65}})
iupx.show_dialog{plot; title="Easy Plotting",size="QUARTERxQUARTER"}
IUP is the most memory-efficient and fast GUI library reviewed here. For example, that last script takes just over 5 Meg of memory on Windows.
lua-gtk is a very comprehensive binding of Lua to GTK+ and other core libraries of the GNOME desktop.
require "gtk"
win = gtk.window_new(gtk.GTK_WINDOW_TOPLEVEL)
win:connect('destroy', function() gtk.main_quit() end)
win:set_title("Demo Program")
win:show()
gtk.main()
Another GTK binding is lgob.
luaplot is a plotting library for Lua, using Cairo and can be integrated with GTK+.
Depending on taste, using Lua with Java or .NET can be a productive way of generating GUIs. For instance, using LuaInterface you have direct access to the excellent NPlot plotting library. Using Lua with Java similarly makes it possible to create fully featured Swing applications.