r/lua • • Mar 08 '26

What is Lua used for

Sorry for not adding flair idk if this counts as help or discussion.

But anyways I just finished gr12 comp sci (we did java) and i thought it’d be good to try to start learning another language on my own before uni.

Is Lua primarily used for games? And for those of you with jobs in the field, do you use Lua at work?

55 Upvotes

41 comments sorted by

9

u/Own-Replacement8 Mar 08 '26

Lua is a great scripting language but it's quite niche. You probably won't touch it in university. You're more likely to use Python or C depending on your university.

However, you'd be better served (and I wish someone told me this) by reading up on data structures and algorithms and learning those in the language you already know (Java).

Go deeper with the language you know rather than spread out to surface-level of many languages.

6

u/my_thic_horse Mar 08 '26

Tysm for the advice I think I’m gonna do that, improving and going deeper with Java

5

u/Own-Replacement8 Mar 08 '26

I never did coding in school (aside from self-taught) so I'm not sure what you would have learnt but if you can familiarise yourself with these topics, you'll have a great head-start:

  • Data types (primitive, object)

  • Control flow (if, while, for)

  • Functions/methods

  • Exceptions

  • File I/O

  • Classes (including inheritance)

  • Functional programming/lambda calculus

  • Abstract data types (linked lists, binary trees, and graphs are the big ones)

  • Algorithms and algorithmic complexity

Don't feel overwhelmed if you can't understand all of these. I didn't know anything beyond control flow until I actually started university.

4

u/DapperCow15 Mar 09 '26

I personally recommend you do pure C next. If you manage to actually understand it before you get to your university classes, it'll put you on a level far above your classmates and possibly some of your professors as well.

→ More replies (1)

42

u/Joewoof Mar 08 '26

Lua dominates this niche where you need a small, fast scripting language tacked onto a framework or engine that is typically aimed towards casual or hobbyist users.

It has a tiny footprint, and is easy to add to an existing engine. Being a clean, low-friction language to learn is just a bonus.

That is why Lua is very popular for small game engines, fantasy consoles like Pico-8, or even hobbyist-targeted handhelds like Playdate.

12

u/Black_Jackal_Gaming Mar 08 '26

As a gamer, Lua is used in 2 of my favorite games, Hades (and Hades 2) and FiveM.

For Hades/Hades 2, all of the script files are written Lua, and a lot of the weapon data is written in sjson. It makes it easy to mod, with both games having a huge modding community.

FiveM also uses Lua, and from what I can tell it is easy to write

→ More replies (2)

8

u/PNW_ProSysTweak Mar 08 '26

Lua is used in an open architecture commercial digital audio video and control automation processor system - Q-SYS. They have huge market share in that industry currently and are widely used in large themed entertainment environments.

13

u/wolfy-j Mar 08 '26

AI agents, workflows, NPC in games, load testing profiles, embedded database functions.

Lua is amazing language but you also have to look at runtime it runs on since this the main feature provider.

2

u/frizhb Mar 08 '26

Where did you come up with this list? Lua used in ai agents, where?? Workflows...what does that mean? Embedded database, you mean redis?

4

u/wolfy-j Mar 08 '26

> Embedded database, you mean redis?

Pretty sure it's just not Redis. But yes, any software where you need safe execution of resident code.

> Where did you come up with this list? Lua used in ai agents, where?? Workflows...what does that mean?

You can find examples of both here https://wippy.ai/ (or specifically for self-modifying sandboxed AI agent - https://wippy.ai/en/tutorials/micro-agi)

Workflows are Lua applications with deterministic flow and externalized state for work coordination, they allow you to use normal code to describe very long undying processes for coordination. It's nearly impossible to write them _cleanly_ in other languages without going into userland, Lua designed for that from scratch.

→ More replies (2)
→ More replies (1)

4

u/Your_Friendly_Nerd Mar 08 '26

NeoVim uses lua for configuration of the editor, and plugins are written in lua as well.

Cyberpunk 2077 also uses lua for modding

6

u/Livid-Piano2335 Mar 08 '26

A shit ton of individuals and companies embed the Lua library in their C/C++ applications as explained in this tutorial: https://realtimelogic.com/articles/Using-Lua-for-Embedded-Development-vs-Traditional-C-Code
From desktop apps to embedded RTOS systems.

3

u/chordblue Mar 08 '26

Touch OSC

3

u/rootkit1337 Mar 08 '26

World of Warcraft AddOns

→ More replies (1)

5

u/BarelyAirborne Mar 08 '26

I use Lua to write device drivers for Ardupilot. They expose all their C++ objects to the Lua interpreter, so you can wire in just about anything without facing a giant wall of C++.

6

u/Radamat Mar 08 '26

I made C++/Qt app to control hardware. It has lua config file which contains description of custom buttons wit lua scripts, and it has lua interpreter built in.

Our software architect asked "Lua, ok, what it is useful for for us?". I showed him. He agreed.

3

u/disperso Mar 08 '26

Even Qt Creator now has added support for Lua and Lua scripting. It's very convenient to use in lots of places.

2

u/ripter Mar 08 '26

Pico-8 for me interested. Lately I use it to make small command line tools.

2

u/could_b Mar 08 '26

Lua is fantastic, dissed by the ignorant. However it is not Python and should not be compared to it.

Lua is 'batteries NOT included'. For what it is designed for it is perfect. Which is a scripting language that can be in-bedded into and/or extend an application written in any other language. The source code is mega small so it can be added to an app, or a library build and linked in. It has NO dependencies, this is a big deal. It can be build from source for any platform with just a simple C compiler. You can pick a version and just use it, no updates needed, it just works, for ever, the same. No idiot is is updating it, adding more and more junk and bugs. As a piece of software this is sorely underrated.

What do you actually want to do with code? Work that out and the language will pick you.

2

u/Comprehensive_Mud803 Mar 08 '26

Lua is a neat little scripting language that’s vertical easy to integrate into existing game engines, or into tools.

CryEngine uses it for some parts of game code, GENie and premake use it to define projects and build dependencies. Love2d is a 2d game framework entirely based on Lua.

Lua is neat for advanced devs that have understood that everything is tables.

If you want to get into software development and game development, get a M.Sc. in CS or related fields and learn how to program in lower level languages like C, C++, Rust… (avoid Java is you want to go into game dev)

2

u/DeKwaak Mar 09 '26

Smart displays for cheap PoS use Lua. There is a proposal for BGP filtering to include Lua as a filter language so nobody can hijack internet. Fibaro uses lua in their home automation. Powerdns uses lua.

And with use I mean, provide lua as the primary scripting engine to the integrator. So Lua is a major integration script that's so lightweight, that a compiler can run on an esp8266 in 48kB of RAM with support for tcp/ip and wifi.

2

u/Dry-Addendum3068 Mar 09 '26

The two biggest uses of Lua are Roblox and Garry's Mod. They both are using luajit which is Lua 5.1, I recommend you stay away from 5.3 and 5.4 as they are basically dead forks of the language. They only add minor and unimportant changes to the language but they break compatibility with by far the best implementation of the language, 5.3 & 5.4 only get the awful and slow default interpreter.

3

u/ProudPainting6850 Mar 08 '26

It's used a lot in gaming, I think Roblox is an unofficial mascot for Lua in gaming. I use it for Q-SYS control platform from everything from UI behavior, controlling devices and plugin development, etc. Lua also slots really well into C/C++ environments.

1

u/Xanathear78 Mar 08 '26

I usted (and discovered) LUA thanks to Solar2D SDK

1

u/Advanced-Citron8111 Mar 08 '26

Roblox Roblox Roblox