Hacker News new | past | comments | ask | show | jobs | submit login

i have recently become interested in lua, especially the fun looking love framework [https://love2d.org/]. but one thing i have had trouble understanding is what lua is particularly useful for and/or used for. can someone explain what type of use cases are up lua's alley? thanks.



One of the most popular and compelling real world uses of Lua is for embedded scripting. It's easy to embed, it's easy to use, for a scripting language it's blazing fast.

I'm sure Lua has other sweet spots, but that's the one I'm most familiar with.


I've mostly experienced it through World of Warcraft -- it's embedded there as the language used to write the game's user interface[1]. Then it's exposed to third-party authors as an API, so they can write addons for the game.

It's also embedded in Wikipedia[2]. Complex templates can be written with Lua modules, rather than relying on wikitext.

[1]: http://wowwiki.wikia.com/wiki/World_of_Warcraft_API

[2]: https://www.mediawiki.org/wiki/Extension:Scribunto


I was introduced to Lua via writing a Wireshark plugin for packet verification. It was hard in the beginning but dove right into working with a C backend. I'd say that's an approachable side project if you want to explore Lua.


It's basically the simplest non-painful-to-work-with programming language that doesn't have a lispy syntax. This makes it very useful for app scripting and programming language experimentation. (And other use cases where you want a dead simple language, but are for some reason averse to parentheses)


Also, Lua's C API for interfacing Lua and C is very pleasant to work with. I did not really get why Lua was so popular until I used it as a scripting/extension language in a small toy project. That was an eye-opener!


I made fedcrawl.com, the entire backend runs on Lua/torch. This involves scraping federal contract sites, cleaning text, and ultimately indexing everything on elasticsearch. It's really just a few Lua scripts running as services via systemd and passing messages with redis. I love it for the speed and how simple the code looks.


At work, I use Lua and LPeg [1] to process SIP messages. It was easy to embed, the coroutine support makes writing an event driven daemon easy (the Lua code is imperative despite being event driven) and LPeg makes parsing text super easy. It's also proven "fast enough" that no real attempt at optimization has been done.

[1] Lua Parser Expression Grammar




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: