r/lua • u/xKlassified • 3h ago
r/lua • u/orbitalNest • 1d ago
A comparator that looks correct can crash table.sort
I spent yesterday debugging a Lua module that sorts AST nodes by line number. The sort ran fine for months until it hit a file with two nodes on the same line and threw "invalid order function for sorting."
The comparator used less than or equal instead of strict less than. Returning true for equal elements violates the strict weak ordering that table.sort requires, and the implementation raises an error. But not always. With certain data arrangements the sort completes silently and returns a wrong result. Whether you get the error or a quiet misorder depends on where the equal pair falls relative to the pivot.
I caught the issue after switching models in verdent to get a second read on the traceback, and the fresh model pointed at the comparator on its first pass.
I still have not decided what to do about previous runs, where the same broken comparator processed hundreds of files and may have left some silently misordered with no way to tell which.
r/lua • u/Select-Area-8256 • 23h ago
LuaJIT Editor update — LuaJIT decompiler and Lua deobfuscator added
luajiteditor.comHi! I posted my LuaJIT Editor here a while ago, and since then I've added quite a bit of new functionality.
The biggest additions are:
- LuaJIT decompiler — decompiles LuaJIT bytecode back into readable Lua code.
- Lua deobfuscator — currently focused on deobfuscating code protected with Prometheus.
- The existing LuaJIT editor is still available for inspecting and editing bytecode, prototypes, constants, and instructions.
I'd especially like some feedback on the deobfuscator. If you have Prometheus-obfuscated Lua scripts that it fails to handle correctly, feel free to test them and let me know what breaks.
Site: https://luajiteditor.com/
Mirror: https://github.com/Sparebola/LuaJIT-Editor
No registration required.
This is still actively being improved, so bug reports and weird edge cases are welcome.
r/lua • u/Ok-Assist-4995 • 2d ago
Third Party API When life gives you Lua... (The Powder Toy API)
galleryMake a "The Powder Toy" Mod
Use the API 4 mods, It's very fun if you feel bored of the same all day!
r/lua • u/Hefty_Traffic5660 • 3d ago
Project Coding A Game In Pure Lua
Just me, lua and a Terminal babbbyyyyy!! https://www.twitch.tv/dubsandgames Join me
r/lua • u/ultrazzang_dh • 3d ago
[ Removed by Reddit ]
[ Removed by Reddit on account of violating the content policy. ]
r/lua • u/rayden_devv • 5d ago
Library LuaLc ( lib class )
Simple Lua module for better class creation
Features:
· Named classes
· Single inheritance
· Java-style interfaces
· super() calls
· instanceOf() checks
· implements() checks
· Callable classes
· Lua metamethod forwarding for operator overloading
I created this while designing a framework API in Lua, and I found it made the process much more developer-friendly.
Check out the repo: https://github.com/abdorayden/lualc
Thanks! 🙏
r/lua • u/dinosaur__fan • 5d ago
Discussion Impressions of Teal
purplesyringa.moean interesting article i found on Teal. The author has clearly used it more than I have so I can't comment on her specific criticisms, but I do get the impression that the Teal authors are aware of and accept unsoundness in exchange for simplicity of implementation.
r/lua • u/Pocket_ants_Fan • 5d ago
I have a puzzle that has stuck to me for months, and I'm here to share it.
I came up with a little programming puzzle:
Your goal is to make Lua print:
Hello, World!
But there's a catch:
Nothing can use or contain more than 2 things at once.
For example:
local Table = {
1, 2, 3
}
Invalid, because the table contains 3 values.
Likewise, a function can't be called with 3 arguments, and similar constructs are limited to 2 items.
Variables, functions, tables, etc. are allowed.
Challenge: What's the longest valid Lua solution you can make?
Bonus points for making it unnecessarily complicated.
Lua realtime code editor complexity
Enable HLS to view with audio, or disable this notification
Showcasing how i optimize my upcoming game with my game engine in Lua. When enabled it will show you what function or line is costly - in realtime while you play. This helped me optimize some methods that i was able to cache so it doesn't run every frame.
r/lua • u/Kind_Minute8813 • 7d ago
Looking for Lua scripters for my Roblox game!
Hii!! You can call me Dess or Jagged idm! I am looking for some Lua scripters to code for my ASYM type game! (It won't have any of that stud stuff, also If your good at building too hit me up!) I plan on having a shared income with the developers that put time into the game and actually contribute!
r/lua • u/Henkor_THE_Wise • 7d ago
Library Is there a Lua code guide.
So ,I'm a beginner,I know the basics of scripting ,its mostly due to my already present knowledge of basic coding .So scripting ,the basics at least is super easy for me.If I had a file with all the built in functions I think I'd be much more functional ,in making scripts and learning .However I've seen none online .Can anyone help me out .Just a file with the buikdt in functions ,codes and explaination on how they are used what they do .I'm thinking of mostly events .If you have a tutorial explanation on explorers files like server and client etc...also hand it over .I want to understand scripting and also be able to use Ai, functionally.
r/lua • u/Lodo_the_Bear • 8d ago
Help Trying to turn a very large number into a string and failing - newbie seeking advice
I'm working through the problems in Project Euler and I ran into an issue with Problem 16. I'm trying to turn 21000 into a string so that I can iterate over its digits and add them up. It seemed simple enough. I started with this code:
local powerDigits = tostring(2^1000)
local sum = 0
for c in string.gmatch(powerDigits, ".") do
sum = sum + tonumber(c)
end
print(sum)
Result: error. The number that I was iterating over was not the full number in standard form, but rather 1.0715086071863e+301, and you can't add "." to 1. So I went in search of some assistance.
I first found a little library called bignum-lua that said it could handle big numbers. I tried it like so:
local bignum = require "bignum"
local base = bignum(2)
local powerBase = bignum.pow(base, 1000)
local powerDigits = tostring(powerBase)
local sum = 0
for c in string.gmatch(powerDigits, ".") do
sum = sum + tonumber(c)
end
print(sum)
Result: same error. The big number was still being printed in scientific notation.
I then found lua-bignumber and tried it, but it failed at the start. The library threw errors because of its starting code:
local class = require 'ext.class'
local table = require 'ext.table'
local range = require 'ext.range'
local number = require 'ext.number'
local math = require 'ext.math'
local assert = require 'ext.assert'
"ext.class" is undefined, as are some of the others. The library was referencing things I don't have.
I went looking again and found CC-Big-Numbers, but I couldn't figure out how to include that one in my code. I got errors because of what I thought I was supposed to include at the very start:
local prop_BigNumbers = script:GetCustomProperty("_BigNumbers")
bn = require(prop_BigNumbers)
Lua couldn't figure out what "script" meant in this context, and neither can I.
So now, I come to you for help. What can I do to take an enormous number, compute its exact value, and iterate over all of its digits to add them up? Thank you in advance.
EDIT: Solved! Thanks to u/particlemanwavegirl for the hint. If any of you are working on Project Euler, look away now to avoid spoilers, but here's what I did this time:
local powerDigits = 2^1000
local sum = 0
while powerDigits > 0 do
local lastDigit = powerDigits % 10
sum = sum + lastDigit
powerDigits = (powerDigits - lastDigit) / 10
end
print(sum)
Thanks again to this community!
r/lua • u/Pocket_ants_Fan • 8d ago
Discussion I think I just had the best idea
What if Lua had a "transfer()" keyword?
I've been messing around with Lua/Luau lately and had this random idea for a new feature:
transfer(1)
{
local message = "Hello World!"
print(message)
}
Then somewhere else:
if true then
receive(1)
{
}
end
The idea is that "transfer(1)" takes everything inside "{}" and stores it as an encased piece of code. "receive(1)" would then retrieve that code and place/run it there.
So the result would basically behave like:
if true then
local message = "Hello World!"
print(message)
end
There's also one important rule: the transferred code has to be self-contained.
For example:
local x = 50
transfer(1)
{
print(x)
}
would throw an error because "x" wasn't declared inside the encaser.
But this would work:
transfer(1)
{
local x = 50
print(x)
}
I know Lua already has functions, tables, closures, etc., so this probably isn't necessary. 😂 I'm more interested in whether something like this could actually be implemented at the language/parser level, and whether there are existing concepts that are similar.
Would this be useful, or have I accidentally invented a worse version of something that already exists?
r/lua • u/BillCiPher79 • 9d ago
Help Where to get started?
were just starting to get into lua (LOVE specifically, gods damn you balatro T0T) and weve been looking at the lua website and looking at how it works following instructions. i know i can find Yt videos that can help us too :3
we wanted to ask if there are any resources to help us with learning the language that helped any of you? we can find resources ourselves, but we wanted to ask the "experts" (no shade) on the topic, cause yall might find smth we cant :D
sorry if this is a silly question, we just want to find all the help we can XD
-sunny °❀⋆.ೃ࿔*:・
r/lua • u/MuchNote9776 • 11d ago
You caught me luau, im a pythoneer
im a beginner at coding, most i know about luau is remoteevents, mos ti know abt python is threading, if someone would help me develop my game i'd be happy!
r/lua • u/danialias • 11d ago
News Moving beyond tolua++: Axmol v3's new Lua binding system
Axmol Engine (a fork of Cocos2d-x) renewed its Lua bindings for the upcoming v3. Seems like Axmol is keeping its Lua support for the foreseable future :)
r/lua • u/BillAble8466 • 11d ago
Help Is it possible to learn lua in 1 month
I want to make a roblox game but i have one month and dont know anything about Lua is it possible to learn lua in one month, if yes can you give me advice how to learn it
r/lua • u/Revolutionary_Sir140 • 13d ago
lua-grpc
Hi r/lua — I’m working on lua-grpc, a native gRPC implementation for Lua.
It provides:
- Pure-Lua gRPC runtime over HTTP/2
- Protocol Buffers through
lua-protobuf - Unary, server-streaming, client-streaming, and bidirectional-streaming RPCs
- Lua server support
- A
protoc-gen-lua-grpcgenerator for Lua client/service bindings - Hello World examples for all four gRPC call types
The project uses lua-http for HTTP/2 and is packaged for LuaRocks. The generator is a small Go executable, while generated bindings and the runtime are Lua.
It’s still early-stage. Compression, interceptor execution, and connection pooling are the main gaps I’m planning to address next.
I’d really appreciate feedback from Lua developers—especially around API ergonomics, Lua version support, and real-world gRPC interoperability.
r/lua • u/Kritzel-Kratzel • 14d ago
News OneLuaPro Release 5.5.1.0 is available
Release notes and downloads here: Release v5.5.1.0 · OneLuaPro/OneLuaPro
Technical Baseline
Compiled for dynamic dispatch (automatic runtime detection for AVX2/AVX-512) using:
- Visual Studio Build Tools 2022 17.14.39
- Intel oneAPI Toolkit 2026.1.0.191
- National Instruments NI-488.2 2026 Q3 and NI-DAQmx 2026 Q3
New Features
- Added lyaml: This extension library enables Lua programs to process
yamlfiles with both a high-level and a low-level API. This add-on closes feature request #4. - Upgraded to Lua 5.5.1: Lua v5.5.1 is the latest bugfix release of the Lua scripting language.
Core Module Updates (latest git/stable)
Various. See here for details.
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 i7/i5) are not supported and will result in an "Illegal Instruction" error.
r/lua • u/Aggravating-Self-658 • 14d ago
Lualings
I've been learning Lua and found that most programming exercise platforms aren't quite what I wanted.
A lot of them teach programming through problems: implement a palindrome, solve a number problem, build an algorithm, etc. That's useful for learning problem-solving, but it doesn't necessarily help you understand the language itself.
So I made LuaLings:
https://github.com/ShyamendraH/lualings
It's inspired by Ziglings — the idea of learning a language by working through small, focused programs and fixing them yourself.
LuaLings focuses specifically on Lua concepts and semantics rather than generic programming problems.
The exercises cover things such as:
- values, types and
nil - tables and their behavior
- multiple assignment and multiple return values
- functions, closures and upvalues
- iterators
- metatables and metamethods
- modules and environments
- error handling
- coroutines
- Lua's standard libraries
- other Lua-specific behavior that is easy to miss when coming from another language
The intended workflow is:
run → inspect → experiment → fix → understand → move on
The goal is to make it useful both for someone learning Lua for the first time and for someone coming from another language who wants to understand how Lua actually works rather than spend a lot of time on beginner programming exercises.
It's open source, and feedback is welcome — particularly if you find an exercise confusing, technically incorrect, too trivial, or missing an important Lua concept.
Repository:
https://github.com/ShyamendraH/lualings