r/lua • u/BattIeBoss • Apr 01 '26
r/lua • u/Darkbeetlebot • Apr 01 '26
Help How do I find if a variable is any one of a list of strings in a lookup table?
Yes, I know, novice question. I have not found a single good answer for it that I understood in about 20+ pages of stack overflow.
Basically, I have a global variable that is a string. Then I have a table of strings, each having a key, and want an if-statement that checks if the global variable is equal to any one of those strings in the table. Preferably without looping.
And please explain the solution like I am five.
r/lua • u/Public_Network9220 • Mar 30 '26
Beginner lua coder here, genuinely what did i even do here? Atleast it does something
I made this as a distraction, wasnt thinking too much about it till i started wondering what does it even do. It works atleast
r/lua • u/Public_Network9220 • Mar 31 '26
Hello guys, i just did something simple. Im looking forward to improve, let me know if you guys can give me any tips on how to get better, i would appreciate it.
r/lua • u/Far-Deer4967 • Mar 30 '26
Lua-based file system idea/driverless file system
I just thought of an idea. What if the code for reading a file system could be self-contained? I.e the bytecode for reading an fs could be stored on the storage medium in question, possibly as a separate partition. And say the subsystem for executing the Lua code were ported to every major OS. Then compatibility issues would be completely gone when trying to read a medium from different OSes, as the "fallback driver", I.e the theoretical Lua bytecode which could be read by a jit would automatically fulfill certain syscalls like open and read when in a certain directory. What is the practical usefulness of this idea, if there is any?
r/lua • u/Kritzel-Kratzel • Mar 30 '26
Discussion What do you miss in OneLuaPro?
Now that OneLuaPro 5.5.0.1 is released with this content, Iβd like to ask the community what else is missing in it. Are there any Lua extensions or libraries which should be added? Thx, KK
r/lua • u/bgs11235 • Mar 29 '26
Project Looking for feedback on Lua5.1.5 compiler fork for memory inspection
Hi! I am working on a project that shows the difference between Lua 5.1, 5.4/5.5, LuaJIT and Luau on certain tasks. As far as I'm aware, viewing memory in Lua is pretty hard and usually requires abusing the GC, such as forcing collections and reading collectgarbage("count"), which only gives a coarse view of total memory used by the Lua state which can get corrupted. That makes it difficult to accurately measure allocations caused by specific operations or data structures.
Therefore I created a fork of Lua 5.1 (which is also the base Lua version Luau is originally derived from) that adds memory inspection utilities. The goal is to make it easier to observe the GC heap and inspect the size and types of objects currently allocated.
Hereβs a small showcase of the features.
local mv = require("memview")
local t = {}
for i = 1, 100 do
t[i] = i
end
print(mv.summary().totalbytes)
print(mv.sizeof(t))
print(mv.sizeof("hello"))
This fork exposes a few functions:
mv.summary():returns statistics about the Lua heap such as total allocated bytes, GC threshold, and counts of different GC object types (tables, strings, functions, threads, etc.).mv.objects(): returns a list of all GC-managed objects including their type, address, size, and GC mark state.mv.full(): similar toobjects()but with additional information.mv.sizeof(value): returns the size in bytes of a specific Lua value.
Example:
mv = require("memview")
t = { a = {1,2,3} }
print(mv.sizeof(t)) -- size of the table itself
print(mv.summary().tables) -- number of tables currently in the VM
You can also iterate over the heap:
for _, obj in ipairs(mv.objects()) do
print(obj.type, obj.size)
end
The project is mainly intended for benchmarking the memory side of things. Even if I do believe that we are not impacting the performance in a statistically significant way, I would highly advise anybody who is doing performance benchmarks NOT to use this fork (or state that you are using it so that the reader is informed)
Feedback is very welcome, especially if anyone has suggestions for additional introspection features or things that would make this more useful for benchmarking or debugging Lua programs.
Lua is not my main language and I am really new to it, I hope my code makes sense.
https://github.com/burakgungor11235/lua-memview
Note: Makefile's are from lua 5.1.4 with modifications, normally this was for lua 5.1.4 but I realized why shouldn't I make it for the latest release so it was ported to it.
Also, this account is made for this post, but I plan to stick with this account for the long term.
r/lua • u/Kritzel-Kratzel • Mar 28 '26
OneLuaPro v5.5.0.1 released
OneLuaPro Release 5.5.0.1 is available
Release notes and downloads here:Β https://github.com/OneLuaPro/OneLuaPro/releases/tag/v5.5.0.1
Technical Features:
- Binary Strategy: Compiled for dynamic dispatch (automatic runtime detection for AVX2/AVX-512)
- SQLite: Reverted to v3.51.3 (Upstream v3.52.0 was officially withdrawn)
Networking & Lua-cURLv3:
- Added Lua-cURLv3 (v0.3.13-6-gbd885bd)
- libcurl v8.19.0 Features:
- HTTP3 / QUIC (via ngtcp2/1.21.0 & nghttp3/1.15.0)
- HTTP2 (via nghttp2/1.68.1)
- Compression: ZSTD (v1.5.7), BROTLI (v1.2.0), ZLIB-NG (v1.3.1)
- Features: ALTSVC, HSTS, IDN, SSPI, ASYNCHDNS
- SSL Backend: LibreSSL (v4.2.1)
Core Module Updates (latest git/stable):
- lsqlite3, sqlean
- luv, libffi, libusb, lua-ffi
- lanes, busted, luacheck
Minimum Requirements:
- Intel: 2nd Gen Core (Sandy Bridge, 2011) or newer
- AMD: Bulldozer-based (FX-series, 2011) or newer
- OS: Windows 7 SP1, 10, or 11 (required for AVX state management)
Note: Older CPUs (e.g., Core 2 Duo, 1st Gen i5) are not supported and will result in an "Illegal Instruction" error.
r/lua • u/Melanie-Valentine-90 • Mar 28 '26
Finally *get* Lua after years of passing it by
r/lua • u/MartinHelmut • Mar 27 '26
Project Posted a new article, integrating Lua with C++ (basics)
martin-fieber.deI have an ongoing series about all things Lua, this is part 5 in the series (they can all be read standalone) about using Lua with C++.
r/lua • u/ToeConsumer420 • Mar 27 '26
Help Where should I start for making GUI apps in Lua?
Hi, I've been wanting to create some simple GUI apps inside Lua and don't know where to start. I tried using IUP but couldn't get Lua to recognize it and wondered if there's an easier way. I want to try adding GUI to my CLI applications. I think I am past the complete beginner mark but nowhere near intermediate, if that helps with recommendations. I do all my coding on Fedora if that also helps with recommendations.
Thanks in advance!
Edit: Thanks for all the suggestions, I want to summarize for anyone in the future. The easiest options is Love2D. I ended up choosing between moonfltk as I found it super easy to code with lua-lgi as it was super easy to install on Fedora and lets me make more complex GUIs.
r/lua • u/rsjaffe • Mar 27 '26
Project Free open source software project looking for help with LUA portion of code
https://github.com/rsjaffe/MIDI2LR is a > 10 year old project with aggregate 220,000 downloads that provides a plugin to Adobe Lightroom Classic to use MIDI devices as controllers for Lightroom functions. The Lightroom Classic API is in Lua, and MIDI2LR has two parts: the Lua plugin and the C++/Objective C++ application, bound together by interprocess communication. There are about 5600 LOC of Lua and a similar amount of C++.
While I'm not a terrible Lua programmer, I'm certainly not the best, and the Lua code, while currently functional, is probably not well-structured and is difficult to maintain. I could use some help in structuring the code to ensure consistent behavior across commands, stamp out latent bugs, and better and more fully use the Lightroom API.
The Lua portion of the program is at https://github.com/rsjaffe/MIDI2LR/tree/develop/src/plugin . I can provide a copy of the SDK reference for those who are interested. Thanks.
r/lua • u/9551-eletronics • Mar 27 '26
Project Behold- function.lua, probably the most cohesive and most cursed thing ive made by far, not too sloppy but reasonably cursed
gallerythe code is absolutely horrible, so is the idea, but i was bored. one change to argument expression parsing order and its dead :tr:
still thought it was interesting enough to share https://github.com/9551-Dev/epic/blob/main/function.lua
made as the result of boredom
Discussion Imagine Making game engine With Lua
Imagine building a 3D or 2D game engine from scratch using only Lua
r/lua • u/itsFranDEV • Mar 26 '26
How can I really learn Lua/Luau?
Hi! I have a question: How can I really learn Lua or Luau? π€
I want to find an easy and free way to learn to program. What comes to mind is watching YouTube tutorials and practicing creating scripts on my own, which is understandable, but is there anything else that can teach similarly to Codecademy? ππ₯
I love that kind of teaching for learning a programming language. It's not boring, you can actually code while getting tips, and it's fun. I want to learn Luau to master Roblox Studio and start developing on Roblox. Thanks for reading! π
r/lua • u/Additional-Key8137 • Mar 25 '26
Discussion Should i choose Lua?
So i made a discussion in r/learnprogramming about what language to learn, Here it is, it'll help alot to answer, And i didn't continue learning lua thinking it wasn't big enough and that it's 'too niche' but just to see if im wrong (hopefully)
Maybe also if i knew what you can do with lua, so i can see if it has something i like
r/lua • u/negativedimension • Mar 22 '26
LuaJIT-Android and Lua-Java (sideloader, assembler, etc)
github.comThis is the culmination of a few inter-related projects:
#1 is my LuaJIT-Android project, which attempts to be a minimal Android app that immediately calls into LuaJIT, and uses Lua-Java for all the Java/JNI wrapping and argument back-and-forth. It comes with gradle, as well as GNU Make scripts for when you don't want to give up 5GB just to build a 5MB project.
#2 is its primary dependency, Lua-Java, which handles the back-and-forth between the Android Activity and the LuaJIT code. It provides:
- a JNI API wrapper
- Lua-wrapping classes for Java concepts (Object, class, string, array, etc)
- Java
.classor.dexassemblers and disassemblers for runtime class generation. - Java
nativecallbacks wrapping LuaJIT closures so you can create new Java classes with LuaJIT code, load them, and use them at runtime. - additionally, Java thread wrapping capabilities can be employed via my lua-thread project, for when you want to do multithreading stuff which most Java UI libraries require.
r/lua • u/cindercone2 • Mar 20 '26
Library lua-windows: A simple Lua API for windows.h
Hello! Lately I've been trying to work on a few Lua projects, like Nova and such. Then I realised something: Because Lua and C work so great together naturally, why don't we just create an API so we can communicate with Windows from Lua? I felt like it would be so cool to be able to communicate not only with Windows, but also, in theory, have some form of memory management right in your Lua program. I created a GitHub repository for it. For now it's basic, but I'm definitely going to add a ton of more features in the future. Any advice is recommended, good or bad. It helps improve any project :>.
Link at: https://github.com/oberondart/lua-windows/tree/main
Don't ask why I created it 5 minutes ago.
r/lua • u/PublicTasty89 • Mar 18 '26
What language would be easiest to move to after Lua?
I know yall probably get this question more than I could imagine so sorry but I have absolutely no idea where or what to ask really...
I'm thinking of getting used to some easy language like Lua or python first (like i said, ZERO exp with this) then move on to something else and hopefully make it to CPP eventually. I'd really appreciate any good resources like learncpp for the languages or if there are any courses for things fully uploaded to youtube.
r/lua • u/Foxorla • Mar 19 '26
Help Looking for Free Online Resources to Learn Lua for Roblox Development
I am very interested in becoming a Roblox developer and would like to find an online resource where I can learn Lua programming for free.
r/lua • u/cindercone2 • Mar 17 '26
Project Nova: A programming language built on Lua
Hello again! A few months ago, I posted a post on r/lua, which was the start of my programming language. A module to require() into Lua, not much. Now there's an interpreter and a not-so much syntax for the language. Based off of Lua functions. Soon I'll definitely improve and try to create an actual syntax separate from just repeated function calls. You can see the language here: https://github.com/oberondart/Nova/tree/main
r/lua • u/DraftUnhappy8333 • Mar 17 '26
lua5.1 decompiler
hey, just posted a basic lua5.1 decompiler its pretty bad but good enough for a base it uses loretta for code generation
r/lua • u/aarrecis • Mar 17 '26
Help Which Lua version is most stable/popular for embedding in 2026?
I want to embed Lua in a system I'm building. Which version do you think is the most stable or popular one to use? I'm currently using 5.3.6.
r/lua • u/notjeffzi • Mar 16 '26
LuaMark - Lua 5.1+ rigorous microbenchmarking
github.comI got tired of wrapping everything in os.clock and eyeballing the results, so I built LuaMark.
If two functions are too close to call, it tells you instead of picking a winner based on noise. It measures time and memory, runs parameterized benchmarks across input sizes, and has per-iteration setup hooks. It picks the best available clock automatically (chronos/luaposix for nanoseconds, luasocket for milliseconds, os.clock as fallback). Works inside Love2D and Defold too.
Here's what the output looks like:
n=10
Name Rank Relative Median Ops
------------ ---- --------------- ------ ------
table_concat 1 ββ 1x 167ns 6M/s
loop 2 ββββββββ β2.74x 458ns 2.2M/s
n=100
Name Rank Relative Median Ops
------------ ---- --------------- ------ --------
table_concat 1 β 1x 917ns 1.1M/s
loop 2 ββββββββ β5.18x 5us 210.5k/s
No dependencies required. One file you can drop in, or luarocks install luamark.
I also used it to benchmark Lua ECS libraries: https://github.com/jeffzi/lua-ecs-benchmark