What is wxLua ?

wxLua is a set of bindings to the wxWidgets library for the Lua programming language. With wxLua you can write programs in Lua that use the wxWidgets cross-platform GUI library to develop and deliver your software with the programming ease of an interpreted language like Lua. Nearly all of the functionality of wxWidgets is exposed to Lua, meaning that your programs can have windows, dialogs, menus, toolbars, controls, image loading and saving, drawing, sockets, streams, printing, clipboard access... and much more.

Additionally, wxLua can be used in your C++ programs to embed a lua interpreter with the wxWidgets API bindings. See the wxLua documentation for more info.

Want an example of how easy it is to write a cross-platform GUI? Here is a simple lua script which creates a wxFrame top level window and a menubar, just add your program to it:

frame = wx.wxFrame(wx.NULL, wx.wxID_ANY, "wxLua Minimal Demo",
                   wx.wxDefaultPosition, wx.wxSize(450, 450),
                   wx.wxDEFAULT_FRAME_STYLE)

-- create a simple file menu
local fileMenu = wx.wxMenu()
fileMenu:Append(wx.wxID_EXIT, "E&xit", "Quit the program")
-- create a simple help menu
local helpMenu = wx.wxMenu()
helpMenu:Append(wx.wxID_ABOUT, "&About",
                "About the wxLua Minimal Application")

-- create a menu bar and append the file and help menus
local menuBar = wx.wxMenuBar()
menuBar:Append(fileMenu, "&File")
menuBar:Append(helpMenu, "&Help")
-- attach the menu bar into the frame
frame:SetMenuBar(menuBar)

-- create a simple status bar
frame:CreateStatusBar(1)
frame:SetStatusText("Welcome to wxLua.")

-- connect the selection event of the exit menu item to an
-- event handler that closes the window
frame:Connect(wx.wxID_EXIT, wx.wxEVT_COMMAND_MENU_SELECTED,
              function (event) frame:Close(true) end )
-- connect the selection event of the about menu item
frame:Connect(wx.wxID_ABOUT, wx.wxEVT_COMMAND_MENU_SELECTED,
        function (event)
            wx.wxMessageBox('This is the "About" dialog of the Minimal wxLua sample.',
                            "About wxLua",
                            wx.wxOK + wx.wxICON_INFORMATION,
                            frame)
        end )

-- finally, show the frame window
frame:Show(true)

Easy, isn't it ? You can see more samples here.

If you use wxLua or you wrote a wxLua-based application, don't forget to tell us about it !

Getting started

  1. get the tools; the download page contains the binary packages which allow you to get started in few minutes. You will find the wxLua and wxLuaEdit applications there which allow you to write and test your (wx)Lua programs.

  2. learn Lua; once you've got wxLua installed and running, you need to learn how to use it: a good way to learn Lua, in case you don't already know, is to refer to the tutorial hosted in the Lua wiki.

  3. learn wxLua; once you've got some experience with Lua language you can start to learn wxLua bindings looking at the documentation page and at the samples in the wxLua/samples directory.

Last, if you need help look at the support page.