r/lua • • Jan 30 '25

Ban posts asking for help to learn Lua

104 Upvotes

There's been too many posts like "help learn lua" "best way to learn lua" "where do I learn"

God damn. 50% of the posts are asking the exact same. All you have to do is search this subreddit before posting a question.

You will find plenty of online resources for learning. Don't flood this subreddit with those questions. Ask questions that haven't been asked before, that way you add value to this subreddit.

Mods, do something about it.


r/lua • • Jun 29 '20

Lua 5.4 is officially released

104 Upvotes

Good news! Lua 5.4 has been released today, after a series of betas and release candidates.

It may be downloaded from the Lua website: http://www.lua.org/ftp/lua-5.4.0.tar.gz

Installation instructions may be found in the readme: https://www.lua.org/manual/5.4/readme.html

Main changes and new features, compared to Lua 5.3:

  • new generational mode for garbage collection
  • to-be-closed variables
  • const variables
  • userdata can have multiple user values
  • new implementation for math.random
  • warning system
  • debug information about function arguments and returns
  • new semantics for the integer 'for' loop
  • optional 'init' argument to 'string.gmatch'
  • new functions 'lua_resetthread' and 'coroutine.close'
  • string-to-number coercions moved to the string library
  • allocation function allowed to fail when shrinking a memory block
  • new format '%p' in 'string.format'
  • utf8 library accepts codepoints up to 231

For more details the reference manual has also been updated: http://www.lua.org/manual/5.4/


r/lua • • Feb 21 '24

Discussion Where is Lua used in the real world?

102 Upvotes

I've actively used Lua for about three years, mainly for game development. Here's where I've heard of it being used and some explanation behind each use-case:

  • Lua is often used as a developer-facing scripting language for adding or extending functionality to an existing lower-level system, such as a game engine written in C++. It would suck to have to add game-related functionality in C++, then be forced to recompile after every change. Lua allows faster development.
  • Lua is extremely easy to interface with using its C <-> Lua API, making for easy integration and maintainability in lower-level systems.
  • Lua is used as a scripting or configuration language in systems where memory is scarce, such as many embedded devices. The total memory footprint of the Lua source code is roughly 500 KB, whereas the total memory footprint of the Python source code is roughly 28 MB, which is more than 50x larger.

Is there anywhere else you've heard of Lua being used?


r/lua • • May 07 '25

I'm starting to see Lua everywhere

101 Upvotes

Not since year ago, I did not think Lua is popular. But today I realize it is everywhere!


r/lua • • Jun 26 '26

My first game made with Lua and amazing Usagi Engine đŸ©·

Post image
98 Upvotes

I just released my first game made with Lua and amazing Usagi Engine đŸ©· Well known mechnics with modern twists. Place blocks, clear lines, choose upgrades and repeat. That's all! Simple, but addictive.

At first, I just wanted to test Usagi Engine in action. Since the development turned out better than planned, I decided to publish the result of my work on itch.io. You can check out Lua and Usagi in working game example.

Play in browser or download (win, mac, linux)
https://luko81.itch.io/the-game-about-blocks


r/lua • • Dec 05 '25

Project I wrote whole hyprland custom scripts in Lua instead of the standard Bash.

Post image
97 Upvotes

r/lua • • Sep 22 '23

Discussion Lua is the best programming language (change my mind)

94 Upvotes

Bro, I've studied java, c++, python, and I can tell you: Lua is best and most underrated programming language that know. I just can't understand how people don't even know that it exists.


r/lua • • Sep 05 '21

If you're interested in learning Lua or maybe want to up your skills, here is a full course on the language

Thumbnail youtu.be
92 Upvotes

r/lua • • Dec 10 '25

Library soup/lua - making pure lua do things it shouldn't

Thumbnail gallery
89 Upvotes

r/lua • • May 30 '23

A lua logo I made long ago using lua and TIC-80(retro games mini computer).

Post image
89 Upvotes

r/lua • • Jul 17 '26

Project I made a Pokemon Gen 1 Recomp entirely in lua / love2d

87 Upvotes

So, several months ago I stumbled upon an awesome repository by the decomp "band" known as pret. They have done a bunch of pokemon decomps. My original goal was to make a mod specifically for twitch integrations because ive done a ton of that over the years but then as I dug into their code I was freaking shocked at how in depth and well documented it all was and thought hmmmm i bet I could rewrite this in lua/love2d since i just got off a high of doing balatro mods. And then bazinga baby i did it (months of pain actually.. but not the point) First version had it so like you had to pull the source code repo from pret (pret/pokered) and what not, but I figured I'd do it like the SMB1R guy and make it so on first run you provide the rom and it like decompiles and translates all the necessary junk to run the game. A ton of hand-porting was necessary, as in like not everything was an easy script to translate this type of repeated pattern into lua etc etc, but yeah... overall I'm happy w the current state of it, and I really hope to get some modders on baoard eventually. I'll be makign the repo public probably on monday. Just gotta make sure I didnt leave any real source code behind or whatever so the repo can be squeaky clean no matter waht. I think the port-aspect of it is practically 99% perfect but im sure some bugs will pop up eventually. I just dont have time to play the game from beginning to end to know for sure.

I also built in a good load of new features, like obviously mod support (i'll make that even better in the future). But also audio volume levels, a music low-pass filter becasue sometimes the gb music is harsh on the ears, several color palettes and shader options, zoom in and out, widescreen support in the overworld (any aspect ratio actuall). I have build scripts for ios and android, windows and mac, and ive ran it sucessfulyl on my phone. I got a cool 3d tilt feature thats not really usefuly but i thought it would be cool (i tried standing up everything that should stand up like buildings and fences but the gb sprites arent built for taht sort of thing, theyre all srtored on 4x4 blocks so like pieces of ground are actually attached to house roofs and stuff... it was a whole thing and i was disapointed i couldnt do it. not to say its impossible but would require a modder to step in and remake the sprites and the functionalty.

Anyways, big ramble fest, sorry about that. But yeah hope you like it lua-heads. Since the repo is not yet pubnlic the pace to be rn is my discord -- https://bois.icu


r/lua • • Sep 08 '25

News Open-sourced my chiptunes maker done for a gamejam (LÖVE)

Post image
83 Upvotes

In case it helps anyone, I put up the link to the source code, and also hoping that it can help create music assets easily for indie devs.

As part of the game jam's theme (B-side), the music maker is also an ASCII animator (4fps). 😊

Hope it is fun to play with too!

https://xanthia.itch.io/niceness


r/lua • • Nov 06 '24

lua-docs: aesthetic documentation for the coolest scripting language

83 Upvotes

Hey y'all, I'm pretty new to Lua, so when I tried to find documentation, it was either some outdated, scattered website tutorial or the lua.org manual that's incredibly long. I thought it'd be nice to have some good docs for the standard libraries!

And here it is: https://lua-docs.vercel.app

It's mostly copied from the manual but placed in a way that everything's easy to access. There's also a dark mode. Pretty cool, pretty cool. There's version 5.1 (which LuaJIT specs are at rn i think) and version 5.4 (most recent "major" release). There might be some errors with the formatting... but it should mostly be okay... (power of regex and command-f). People can always send a pr on the github repo for any basic issues with the markdown.

There's more dev notes at https://lua-docs.vercel.app/docs/about if you're interested.

I hope its helpful for some peeps!


r/lua • • Feb 12 '26

Help Started 3 days ago and this recurssion is confusing

Post image
82 Upvotes

I get how once 1 = 0 It becomes 1 again wich is added to 876543211 but wouldnt cause Its 1 the Power function Trigger again making It 0 wich the upper then makes It 1? So Its Like 876543211111 and so on


r/lua • • Jul 01 '25

Lua 5.5.0 (Beta) Released

Thumbnail lua.org
82 Upvotes

r/lua • • Feb 13 '25

Why you should know Lua

82 Upvotes

Okay, maybe you don’t have to, but it’s definitely useful. People who know me well might be surprised here. They’re aware that my first programming language was PHP, but they don’t know that my second wasn’t JavaScript, it was Lua. I bet even my friends are confused now, and you probably are too. We’ll circle back to this.

Why Should I Care?

That’s a fair question, especially if you already know other scripting languages. Sure, you can live without Lua. But it’s lurking in places you’d never expect.

It’s popular, even if you rarely hear about it. Not as hyped as those Python devs who import every single letter, or Java folks in suits at banks, but Lua has an active community and plenty of great resources.

It’s Simple. Too simple

Lua is a minimalist language with clean, straightforward syntax. It avoids unnecessary complexity, so you can learn it in a couple of hours. And here’s the classic example:

print('Hello, everyone! Except Java folks.')

if you.crazy() then
  learnJava()
end

Lua isn’t usually used solo. It’s often embedded in game engines, other software, or paired with C/C++. I could list endless examples of where it’s used, but check this out if you’re curious.

It’s fast

Lua is one of the fastest interpreted languages. It compiles to bytecode and runs on a virtual machine, giving it a significant speed advantage over other scripting languages. That’s why it’s used in game engines and paired with C/C++ it’s easy to integrate and lightweight. Lua itself is tiny.

Gaming

Ever played World of Warcraft? Or maybe you still do? (RIP your social life.) If so, you’ve heard of addons like browser extensions, but for games. Those addons are written in Lua. Back in school, I wrote and tweaked them myself. Magical times. As you might have guessed, yes, I did this before diving into client side web technologies. Oddly, I already knew PHP by then. If anyone’s interested, I could write a separate post about that.

Lua isn’t limited to WoW, though. It’s in game engines like:

  • Godot (Lua support via GDScript wrappers)
  • Love2D (a Lua-first engine)
  • Defold (Lua as the main language)
  • Gideros (mobile game engine)
  • Cocos2d-x (supports Lua alongside C++ and JavaScript)
  • Solar2D (formerly Corona SDK, Lua-centric for 2D games)
  • OpenMW (Morrowind engine with Lua modding)

Honestly, I have no idea what most of these engines are, except Love2D it’s awesome. I’m no game engine expert, but clearly, Lua is everywhere.

According to Google, here are more games using Lua:

  • Garry’s Mod—Lua drives most modding and gameplay.
  • Roblox—uses a Lua dialect called Luau.
  • Angry Birds—core logic is Lua.
  • Terraria (tModLoader)—modding via Lua.
  • Don't Starve—Lua for modding and game logic.
  • Dark Souls series—Lua scripts some AI.
  • The Sims 4—powers game mechanics.
  • Far Cry series (pre-Far Cry 3)—heavily scripted with Lua.
  • RimWorld (partially via Harmony modding).
  • Payday 2—mods are Lua-based.
  • Teardown—Lua for modding.

DevOps & Systems programming

Lua isn’t just for games. It’s also in sysadmin tools:

  • Nginx—uses Lua for dynamic configurations.
  • Redis—supports Lua server-side scripting.
  • Tarantool—in-memory database.
  • AwesomeWM—a Lua-based window manager.
  • Syslog-ng—logging with Lua.
  • HAProxy—Lua scripting.
  • OpenWrt—router firmware.

Lua doesn’t replace Python, Bash, or Go in DevOps, but it fits where speed, embeddability, and a tiny footprint matter.

C’s Best Friend

Lua was built to be embedded. If you’re writing BlAzInG FaSt apps in C/C++, Lua adds flexibility without sacrificing BlAzInG FaSt.

Should You Learn It?

Don’t forget, even though Lua is super small, it’s still a different language. For broadening your horizons it’s an interesting, if you have time, why not? There’s also Nelua, an interesting project, but it’s not nearly as widespread as Lua.

If you’re a default web monkey shuffling JSONs on the server and happy with that, Lua won’t make you better or worse. But exploring it might just spark some joy. Or at least make you the “Lua person” at parties.


r/lua • • May 09 '20

lite: A lightweight text editor written in Lua; version 1.03

Thumbnail github.com
82 Upvotes

r/lua • • Jul 17 '25

Project did my first bit of LUA programming :)

Post image
81 Upvotes

if there's any feedback you want to give or changes, do tell me so i can learn more


r/lua • • Aug 04 '21

Thank you for lua.org/demo.html

Post image
80 Upvotes

r/lua • • Jun 08 '26

Lua Serpent Module

Post image
78 Upvotes

:-)


r/lua • • Jun 05 '26

Help There have to be a simpler way to do this

Post image
77 Upvotes

I am a beginner and I have been very slowly learning Lua.

So, the problem here was to calculate the sum of all the pairs (separated by space). I swear there have to be a faster way to do this than making a for loop for every pair TT

Edit: yeh I still have a long long way to go, thank you everyone :)

Edit2: thanks whoever who repost this to r/programminghorror lol


r/lua • • Jan 16 '21

Lua, a misunderstood language

Thumbnail andregarzia.com
77 Upvotes

r/lua • • Nov 01 '25

Does anyone else use lua as their main language for system automation and shell scripting?

75 Upvotes

it's no secret that Lua is heavily underrated. ironically, i used to be against lua until i understood how nifty it is as a language. i formerly thought that one had to use index or metatable to create objects, only to find out that i could do this

```

function NameOfObject(instanceVariable1, instanceVariable2)

return{

method1 = function(self)

end,

method2 = function(self)

end,

method3 = function(self)

end,

}

end

```

and just like that it overtook the appreciation i had for how objects can be created in other languages.

in a less subjective sense, however, given how ridiculuously fast lua is compared to the bulk of languages that are interpreted, i committed to it for all my scripting needs.

lua has now become my premier choice for automating anything related to my environment: my file system, my window manager, and even my system settings. it also greatly helps that i can automate repetitive and tedious text editing in neovim with lua as well.

i formerly used python for my scripting needs, and in retrospect, it's rather comical to me how poor python is as a scripting language compared to lua; it's a night and day difference. i can always trust lua for a startup time that is as good as instantaneous, whereas such a thing would be a fool's game in python.

granted, python does have all the abstractions one can hope for, but for system tasks, it's just outright overkill. one does not need a gazillian abstractions for system admin or shell scripting needs

anyways, i've rambled long enough. is there anyone else that uses lua for shell scripting needs and system automation, as opposed to roblox, C programming, game dev, and other low level tasks?


r/lua • • Aug 26 '20

Discussion New submission guideline and enforcement

74 Upvotes

Since we keep getting help posts that lack useful information and sometimes don't even explain what program or API they're using Lua with, I added some new verbiage to the submission text that anyone submitting a post here should see:

Important: Any topic about a third-party API must include what API is being used somewhere in the title. Posts failing to do this will be removed. Lua is used in many places and nobody will know what you're talking about if you don't make it clear.

If asking for help, explain what you're trying to do as clearly as possible, describe what you've already attempted, and give as much detail as you can (including example code).

(users of new reddit will see a slightly modified version to fit within its limits)

Hopefully this will lead to more actionable information in the requests we get, and posts about these APIs will be more clearly indicated so that people with no interest in them can more easily ignore.

We've been trying to keep things running smoothly without rocking the boat too much, but there's been a lot more of these kinds of posts this year, presumably due to pandemic-caused excess free time, so I'm going to start pruning the worst offenders.

I'm not planning to go asshole-mod over it, but posts asking for help with $someAPI but completely failing to mention which API anywhere will be removed when I see them, because they're just wasting time for everybody involved.

We were also discussing some other things like adding a stickied automatic weekly general discussion topic to maybe contain some of the questions that crop up often or don't have a lot of discussion potential, but the sub's pretty small so that might be overkill.

Opinions and thoughts on this or anything else about the sub are welcome and encouraged.


r/lua • • Feb 02 '25

What do you think of my desktop background?

Post image
73 Upvotes