Following vtrlx’s tutorial about writing GNOME apps with Lua

This one: https://www.vtrlx.ca/posts/2025/howto-complete-lua-gnome-app/

I’m on Mint.

Background

I’m a developery type but I would describe myself as a “casual Linux user”. My software background is Java (largely minecraft) and web stuff. I know a little about sysadmin, but not that much.

I’ve used a little bit of Lua, mainly to write a Pandoc filter (and some totally dead NotITG projects).

I’ve never worked with flatpak before. I’m coming in with a somewhat negative opinion of it (due to its sandboxing breaking a program I wanted to use, in a mysterious and hard-to-debug way) but I am interested in learning more.

What does she have me installing

I popped open Software Sources and checked “Source code repositories”. Dunno if I actually needed to do that! Can’t hurt.

I’m already in version hell lmao

I installed lua5.4. I have a lua5.4 command. Okay.

I already somehow installed a mystery /usr/bin/lua which is actually 5.1, and I have a lua5.1 command.

I ask doctor how to find which package installed a program. Doctor says dpkg-query -S is in town. But Doctor,

quat@moon:~$ dpkg-query -S /usr/bin/lua
dpkg-query: no path found matching pattern /usr/bin/lua
quat@moon:~$ /usr/bin/lua
Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio

Whatever man!!!

I think the reason I have this in the first place is that whoever packaged luarocks for Debian made it depend on lua5.1 | lua5.2 | lua5.3, but not lua5.4 (and/or they’re packaging a version that doesn’t work on 5.4).

Okay, there is an update-alternatives system, I’m familiar with this from Java. I think this is the right way to do it:

quat@moon:~$ sudo update-alternatives --set lua-interpreter /usr/bin/lua5.4
update-alternatives: using /usr/bin/lua5.4 to provide /usr/bin/lua (lua-interpreter) in manual mode
quat@moon:~$ sudo update-alternatives --set lua-compiler /usr/bin/luac5.4
update-alternatives: using /usr/bin/luac5.4 to provide /usr/bin/luac (lua-compiler) in manual mode

I found these through update-alternatives --get-selections | grep lua. Idk if there’s a better way to find these.

And then remember to use luarocks-5.4 instead of just luarocks so it also uses the right version, beacuse the unadorned command uses the fucking Lua 5.1. Why is there no update-alternatives for the luarocks?

Also where do the packages go!! I’m curious!! I guess they call it a “rocks tree”?

This is my hangup:

Lua has some bonkers require semantics I’ll need to figure out, I guess.

I can’t luarocks-5.4 install luagobject because of

Error: Failed finding Lua header files. You may need to install them or configure LUA_INCDIR.

Okay, now I can luarocks-5.4 install luagobject. (It seemed to invoke gcc and make so I imagine if this isn’t working build-essential would be a good package to install.)

getting my flatpak bearings

I know Mint ships with “flatpak support” – not sure exactly what that entails but I didn’t think I’d need to manually configure Flathub as a remote. Sure enough, flatpak remotes --columns=name,url mentions a flathub remote already, same URL, good to go :)

Let’s get sidetracked looking through flatpak list.

I saw mention of a user-specific flatpak (as opposed to a system-wide flatpak) available thru flatpak --user, but flatpak --user list and flatpak --user remotes list nothing so I don’t think I’ve installed any of those yet.

But I do need to get the “gnome sdk” which is different than the Platform. From what little Flatpak-documentation I’ve read so far, flatpak-builder wants to build your things “in a separate environment”. I guess this is related to when people build their shit in a docker container? Because the Gnome SDK exists, I didn’t have to install packages like libgirepository system-wide to compile my stuff, it’d (presumably) be part of the SDK if I built and ran the program “through Flatpak”.

Okay let’s actually do it

At this point I was able to successfully write require "LuaGObject" and run it

I just followed the first bit of tutorial as-written and have an empty window with titlebar I can drag around, maximize, and close. Hurrah. If I put my computer in 🤮dark theme🤮 the background even turns black.

Well this is downright pleasant, compared to my experience with the Windows api. Lol.

Haven’t touched anything flatpakky yet.