r/lua • • Mar 11 '25

Help Newbie question - how to display values of a table in alphabetical order?

8 Upvotes

I'm working on a simple word game which includes a list of words that the player is trying to guess. I'm implementing this with a table of values in which the keys are the words and the value for each one is true if the player has already guessed it and false if not. I want the player to be able to review the words they've already correctly guessed, and I want the words displayed to be in alphabetical order. Getting the program to display only the true flagged words is easy enough, but I don't know how to get it to sort the words. What can I do to sort the keys and display them in the order I want?


r/lua • • Mar 11 '25

LuaX - Like React, but it supports any UI library (beta)

31 Upvotes

Today I released version 0.5.0 of LuaX, which is a library I've been working on that allows you to create interfaces using "html with lua" syntax attached to any UI library. It's written in pure lua, and happened to be my first time developing a language parser of any sort. Currently, it supports Gtk Via LGI, the web via Fengari, and AwesomeWM's wibox widget system. There are code samples for Gtk and the web in the repository.

Unfortunately my documentation is still lacking somewhat, but I'd love to hear people's opinions on it. My eventual goal is to write a standardized component library, so cross-platform lua app development would be a breeze.

https://github.com/oezingle/LuaX

Edit: it seems some folks are confused about the scope of LuaX, which is my fault - I wrote this post very very late at night. The syntax is only part of what LuaX does, and you can use LuaX without the special syntax if you prefer. LuaX isn’t a templating engine but an asynchronous-ready reactive rendering system, meaning that you can write components that combine responsive logic with UI elements.