Reputation: 603
First I'll show you an example of what I am talking about: GUI Example
I've been studying Lua for around a week now, and I'm really curious of how I would do this. Basically (for now, and learning purposes), I just want to make a GUI with 2 buttons, 1 to start the specified (.exe), and one to exit the GUI.
Is this possible? How would I go about doing this? Any information would be great!
Upvotes: 19
Views: 87640
Reputation: 21
you may take a look at LuaRT. LuaRT is a Windows programming framework for Lua. Did not test myself, but a brief look into the documentation should tell you If you can get your app up and running.
Upvotes: 0
Reputation: 41
I know it's been years. But try out Limekit, it offers a simplified Qt API, has material UI, dark snd light themes
https://limekit.readthedocs.io/en/latest/
Upvotes: 0
Reputation: 7962
In my opinion, the web technologies like HTML/CSS/JS are the way to go for UI development.
There is a lightweight and capable tool with just around 8 MB
in size to launch web UI on a desktop. You can download the scapp.exe
executable from here: https://gitlab.com/sciter-engine/sciter-js-sdk/-/tree/main/bin/windows/x64?ref_type=heads
You can place the scapp.exe
next to your HTML/CSS/JS code:
Then just run on the command line:
scapp.exe index.html
I used this sample app: https://gitlab.com/sciter-engine/sciter-js-sdk/-/tree/main/samples/calc
The app runs just fine:
Upvotes: 0
Reputation: 41
IUP should be the easiest way to create a GUI with Lua. However you will meet a brick wall if you try to install IUP on Linux. You have to hope someone has pre-installed it or someone has pre-written an install package for your version of Linux. If you want other people to be able to run your code later it will be virtually impossible to set things up in reasonable way. That is really an error by the Lua/Iup team because I have no trouble in using Iup from the C programming language and it seems to be widely compatible with many versions of Linux. It is the opposite of the usual situation where it is very easy to set up a scripting language and difficult to set up a low level language like C.
Upvotes: 4
Reputation: 6985
If you are an absolute beginner, i.e. you don't have any programming experience in other programming languages, I advice you to learn Lua very well without trying to mess with GUI programming, which is inherently much harder. When you will have a good understanding of Lua, then go for a GUI toolkit for Lua. I use wxLua so I can only give you some hints on that.
Since it is not a "native" Lua toolkit, but it is a "binding" to a well-known cross-platform GUI library (wxWidgets) you must study both the wxLua documentation and wxWidgets manual (at least to some degree).
wxLua binary distribution comes with everything needed to use it (you don't even need a separate Lua interpreter, it has its own) and contains a good number of example applications.
The following script is a trivial approximation of what you want to do, but (I repeat myself) you should really learn the basics of Lua before attempting GUI programming.
local wx = require 'wx'
local PATH_TO_APPLICATION = [[notepad.exe]] -- Windows assumed for sake of exemplification
local ans = wx.wxMessageBox( "Should the application be started?", "Hi there!",
wx.wxOK + wx.wxCANCEL + wx.wxICON_QUESTION )
if ans == wx.wxOK then
wx.wxExecute( PATH_TO_APPLICATION )
end
To run the previous script you must be sure that wxLua is installed correctly in your interpreter search path. Otherwise you must use the wxlua.exe
interpreter that comes with the distribution.
Note also that wxLua interpreter (latest wxLua stable release) runs with a version of Lua 5.1, so try not to use features of Lua 5.2 in your scripts. Basic Lua syntax and semantics is almost the same, but there are some slight differences and Lua 5.2 has a couple of added features. So be careful with your learning path.
Upvotes: 6
Reputation: 1717
Another example is IUP: http://www.tecgraf.puc-rio.br/iup/
It is supported for Microsoft Windows and Unix
Upvotes: 3
Reputation: 1491
I believe you may want to take a look: http://lua-users.org/wiki/GraphicalUserInterfaceToolkits
If you want something well know and tested I would go to Qt, if something light: FLTK.
Upvotes: 13
Reputation: 2773
Have you checked wxLua ? This is the only desktop gui framework I am aware of for Lua.
Upvotes: 3