Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
LuaRT: Lua programming environment for console, desktop applications for Windows (luart.org)
188 points by thunderbong on May 25, 2024 | hide | past | favorite | 44 comments


I'm always looking for alternatives to AutoHotkey and small C WINAPI programs I've written. Rust doesn't quite cut it, even with Microsoft's windows-rs library using the WinAPI functions is worse than it was with plain C. This is because you have to hunt the right libraries and features to import, it's surprisingly time-consuming.

Excited to look how LuaRT exposes WinAPI, my ideal would be one global namespace where you can easily auto-import all the normal functions. Microsoft has made it somewhat easy for library authors to generate the externs with their relatively new Win32metadata package: https://github.com/microsoft/win32metadata


LuaRT encapsulates the Windows API around a think object oriented layer for Lua. All objects, properties and functions are organized with Lua modules


> I'm always looking for alternatives to AutoHotkey and small C WINAPI programs I've written. Rust doesn't quite cut it ...

You can access the win32 api in Node via Koffi. Here's a MessageBox example: https://koffi.dev/start#for-windows

Also see node-activex (https://github.com/durs/node-activex)

AHK2's syntax is also very close to Javascript these days. It's quite pleasant to use and the C++ source is very well-documented.


I know not everyone loves the syntax, but that would be relatively easy with Powershell, or than plain .NET.


It's not just the syntax. Powershell is just ridiculously slow for doing things like iterating through text files.

Don't get me wrong... powershell is really nice for some kinds of IT work, but I've had lots of trouble with it. I love the succinct nature, but it takes a lot of effort to get a line of code to do what you need it to do...even after you've spent a LOT of time with the language.


    PS C:\> Find-SuccinctNature PowerShell -ComparedTo Bash

    Find-SuccinctNature: Object not found


As someone that has DevOps as part of job activities, it is quite alright.

Plus if performance matters, rewriting the critical part in a .NET language is always an option.


Why not Delphi? It's been the goto for quick Windows apps for a couple of decades. Lots of functionality inbuilt.

There's a free Community Edition: https://www.embarcadero.com/products/delphi/starter/free-dow...


Maybe because Lua is an easy and interpreted programming language for beginners ?

Maybe such a big solution is not needed for tiny sized projects ?

Maybe we don't need fatty big executables for the ease of deployment ?


Lazarus? Tcl/Tk (no, really, it's great)? PyWin32?


LuaJIT has access to the system libraries:

https://luajit.org/ext_ffi_tutorial.html#sleep


Not a programmer, but I see it can use COM objects :

https://luart.org/doc/sys/COM-constructor.html

does that mean we can use it to manipulate Office files just as in VB or PowerShell ?


I'm the main author of LuaRT. Yes LuaRT can automate Office apps through COM


Can COM automation work between two networked Windows desktops?

Edit: I guess that would be DCOM, https://en.wikipedia.org/wiki/Distributed_Component_Object_M...


I don't have tested this


Great job, thanks for your work !


Thank you :)


A COM client will let you control Office desktop applications, and use those to open and edit Office files. You need them installed first.

(Contrast with Doug Finke’s Import-Excel module for PowerShell which can work with Excel files without Excel installed, and Przemysław Kłys‘s PSWriteWord module that can write Word files without Word. They can’t do as much as full Excel and Word can).


Thanks this is very clear. I use COM objects through PowerShell too, not the Import-Excel module, because I cannot install anything (except Office) on my client's work machine. But I can copy binaries so working with Lua might relieve my headaches from working with PowerShell :)


From the PowerShell Github releases page[1] you can expand 'assets' and 'show more assets' and find a ZIP distribution which doesn't need installing, unzip it. e.g. PowerShell-7.4.2-win-x64.zip . Then from PowerShell 7 somewhere, run

    Save-Module ImportExcel -Path C:\Whatever\
and copy that module folder along with the PowerShell folder to the remote machine, and you can import modules from a full path:

    Import-Module C:\Whatever\ImportExcel
and do a no-install copy-paste deployment of powershell 7 and modules. (I'm not saying you should do this instead of using Lua, just that you can).

[1] https://github.com/PowerShell/PowerShell/releases


Nice, thanks. But I have other limitations as well (Powershell 5 only and scripts must be signed, which I believe includes external modules).

Don't ask me why I can run a random binary instead, I don't know and I don't want to know.


Very cool! This reminds me of the program I used as a kid to make GUI apps.

https://www.indigorose.com/autoplay-media-studio/screenshots... (surprisingly it works for W11)

Lua was my first language, and it enabled me to make desktop apps for tools I needed.

I think this is very much needed as a lot of kids learn Lua from Roblox and game mod communities.


ZeroBrain studio is also good.


ZeroBrain was nice but it's just an IDE.

AutoPlay Studio and the one featured here makes full GUI apps.


TekUI integration with a builder might be an interesting feature. It's a bit dated but the latest release compiles just fine and examples work. Years ago I tried it also on a small Allwinner ARM board with output to the framebuffer (no Xorg) and it worked fine. I wonder why it is still semi-unknown.

http://tekui.neoscientists.org/


It's an IDE, but it allows building full GUI apps. It's itself written in Lua using wxlua/wxwidgets toolkit, so has access to the majority of the modules availables in wxwidgets. The binaries are also bundled with the IDE for all supported platforms, so you can develop and package your own application in the same way.


Tiny nitpick: It's ZeroBrane


LuaRT is based on ZeroBrane, actually :-)


I wish I had a similarly well maintained analogue for macOS.


LuaRT is open source, maybe someone will make a MacOS port


Out of curiosity did you test it under Linux with Wine? :)


Yes I have tested it several months ago, and it worked. Don't know now if it's still the case


> Windows versions older than 8.1 are no more supported

Does this mean it's simply no longer tested on Win7, or that it absolutely won't work?


LuaRT will work on older versions. Latest UI feature (themes, HighDPI) won't work. But any feedback on older versions is welcome


Anything about XP?

PS: I'm not kidding! Some customers (government) are still on XP...


> still on XP

Hopefully not connected to untrusted networks..


actually they are working in separated networks w/o access to internet


One major missing element on the GUI page is some kind of table widget that can display tabular data. A lot of GUI needs involve needing to display data, but many widget toolkits just have things like buttons, radio buttons, message boxes, and tree/hierarchy things.

Besides that...I really like this project.


Thank you :) A Grid widget is planned


Yessss! Thank you!


Lua is a great little language and I see this has an object system with mixins. Will give it a try to see how it compares to my current tool for writing Windows desktop apps - Dolphin Smalltalk


What is this Lua excitement all around?


It strikes this unique balance between simplicity, productivity and raw performance.

It’s certainly not the right language for all use cases. But embedded or extending, it particularly does well.


Think Python but smaller and simpler, less batteries included




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: