What is wxLua ?

wxLua is a set of bindings to the C++ wxWidgets cross-platform GUI library for the Lua programming language. You can write complex, graphical, interactive programs with wxLua 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 installed to make development easier or to provide a scripting extension to the program's users. See the wxLua documentation for more info.

Want to see 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 a few minutes. You can use the wxLua and wxLuaEdit applications write, debug, and run 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 on the Lua wiki.

  3. Learn wxLua: Now that you have some familiarity with the Lua language you can learn about wxWidgets. There is information about the wxLua bindings on the documentation page and the samples, in the wxLua/samples directory, might be helpful too.

Finally, if you need further help, please look at the support page.