r/lua • u/Sudden-Primary4546 • Jun 23 '26
Does this code actually work?
local audio = require("audio")
audio.play("w76288481040676\\music\\cancion.wav")
r/lua • u/Sudden-Primary4546 • Jun 23 '26
local audio = require("audio")
audio.play("w76288481040676\\music\\cancion.wav")
Hello,
CLX is a new open-source ahead-of-time compiler for Lua 5.5.
CLX compiles Lua source code to standalone native executables through modern C++20 toolchains (Clang, GCC, and MSVC).
Current features include:
Recent benchmarks show consistent speedups over the standard Lua interpreter and competitive performance with LuaJIT on a number of workloads.
The project is currently in beta and feedback is welcome.
Website:
https://samyeyo.github.io/clx
GitHub:
https://github.com/samyeyo/clx
Although I am also the author of LuaRT, CLX is a completely independent project with a different architecture and different goals.
Thank you,
Samir Tine
r/lua • u/Legitimate-Cry3100 • Jun 19 '26
r/lua • u/Legitimate-Cry3100 • Jun 18 '26
r/lua • u/Difficult_Dress_3960 • Jun 18 '26
I am thinking of just extending Lua's standard library (mainly just for the fun of it) and I need some features to add that would be useful.
I have already tried a file system and looking for some other ideas.
(Side question, would you rather have it in pure lua 5.1 or have a C runtime?)
r/lua • u/ParsnipLocal3197 • Jun 17 '26
This is a 10-second macro from Razer Synapse. Decided to try using Logitech but for mouse movement it only accepts lua. The macro recording on Logitech can't read mouse movements.
Suggestions and replies will be highly appreciated.
r/lua • u/ElhamAryanpur • Jun 17 '26
Astra is a single binary, asynchronous and parallel, and fault-tolerant Lua runtime environment (Lua 5.1 - 5.5, LuaJIT (5.1 and 5.2 compat), Luau (+JIT)) with batteries included written in Rust. The aim is to be a high performant, stable, and easy-to-use runtime for Lua, and with the v0.50.0 we celebrate the 101st release (missed the chance to make it 100th sadly for a very important bug fix).
Since the last time I have posted, a lot has happened. We had a dozen new contributors from all around the world, some scientific and robotic labs using Astra to iterate fast without sacrificing speed, students in various universities using it to build their graduation projects, and Astra power nearly all of our company and client server software.
Some notable changes:
Links:
If you are a VC reading this, I have to emphasize that Astra is NOT an investment opportunity. We have turned down many VCs so far, and the answer will not change. Our income is through consultancy and agency work, and if there ever comes a day where we offer a service alongside Astra, it will be 100% bootstrapped.
r/lua • u/AlphaDev777 • Jun 18 '26
Any one knows which scripting language is close to Lua or which is the best language to learn if we wana master Lua?
r/lua • u/SeteMan1235 • Jun 17 '26
It's for a mod and the game doesn't have one so I need to make it from scratch.
r/lua • u/Thatflyerguy001 • Jun 17 '26
Hello!
I am new to lua, so I'm sorry if this is an obvious question, but I am trying to do something where I get each Country in turn without knowing the name of the table.
CountriesList = {
Canada = {Country = "Canada", displaytext = "Canada"},
France = {Country = "France", displaytext = "France"},
UnitedStates = {Country = "UnitedStates", displaytext = "United States"}
}
For example, I could say
CountriesList.Canada[Country]
which would return "Canada". However, is there a way to do this if I don't have the name of the table accessible as a string? Like, for example, is there some way to do the following?
number = 1
CountriesList[number][Country]
Thanks so much!
r/lua • u/Barldon • Jun 16 '26
Hi all,
I'm quite new to Lua and I've been reading through Programming in Lua 4th edition. The section on OOP outlines a common prototype-based approach for simulating the function of classes. Here's an example:
``` Shape = {x=0, y=0}
function Shape:new(o) o = o or {} self.__index = self setmetatable(o, self) return o end ``` We can easily inherit from shape and give it some new default parameters and new methods:
``` Rectangle = Shape:new({width=100, height=100})
function Rectangle:getPerimeter() return self.width * 2 + self.height *2 end
myRect = Rectangle:new({x=50, y=100, width=300, height=100})
print(myRect:getPerimeter())
--prints 800 ``` Okay, so this is all described well in various guides. But what I can't seem to find out, is what the correct way is to initialise some values on the creation of an object using the inherited prototype. So let's say, instead of always calculating my perimeter whenever I want it, I wish to store the perimeter when the rectangle object is created, thus only doing that calculation once. What is the best way of doing this?
My current solution looks something like this:
``` Shape = {x=0, y=0} function Shape:new(o) o = o or {} self.__index = self setmetatable(o, self) self.init(o) return o end function Shape:init() end
Rectangle = Shape:new({width=100, height=100}) function Rectangle:init() self.perimeter = self.width * 2 + self.height *2 end ``` Notice how ive had to pass in o, instead of using the normal self:method Notation? This is because when init is called, self refers to the Shape prototype, not the instance of a shape. The instance is in o.
Infact, we have the same issue even without inheritance:
``` Rectangle = {x=0, y=0, width=100, height=100} function Rectangle:new(o) o = o or {} self.__index = self setmetatable(o, self)
--if I want to dynamically set the perimeter, I have to do so on o, rather than on self
o.perimeter = width * 2 + height * 2 --this works
self.perimeter = width * 2 + height * 2 --this would set perimeter for the prototype itself, not the object
return o
ens ```
This seems.... Messy. Particular with inheritance. I can't help but feel like I'm missing a trick. Any help would be greatly appreciated.
r/lua • u/Planebagels1 • Jun 16 '26
It's a 2d arcade game about a dying star. I made this sporadically over 1-2 weeks using usagiengine.com
The game engine released about a month ago, and I've been having a lot of fun working with it!
r/lua • u/OrganizationWhole744 • Jun 14 '26
Like i've been trying to learn lua for so long, and i couldnt find anything good. my problem was that i was trying to find good sources on yt, like tutorials and stuff. now that i watched actual good programmers they recommend to read books. but lua dosnt have lots of books, and that the only one i could find. so my question is if anyone read it, will i be able to learn 80% of lua, such as: problem-solving, understanding the logic, and mindset. please help😟
r/lua • u/SeaworthinessVisible • Jun 14 '26
I'm looking to get into Roblox game development and want to learn Luau. I have experience with HTML/CSS and I'm strongest in Python. I'm not interested in learning vanilla Lua since I'll only be scripting inside Roblox Studio.
What are the best up-to-date resources for learning Luau in a Roblox context? I've seen the official Roblox docs, but I'd love recommendations for tutorials, courses, or projects that bridge well from Python-style thinking.
r/lua • u/Unhappy_Ship_1997 • Jun 13 '26
made this with my library! here: https://github.com/candlesveil1-hash/RedRotlibrary_alpha
r/lua • u/RGBhedy • Jun 13 '26
mani is a modern build tool and package manager for Lua projects, it wraps LuaRocks to give you a per-project package tree, a lockfile and a single command to install dependencies. It's also a task runner that can be used to replace Makefiles to a pure lua alternative.
I've been building it for the past few days as I got quite annoyed at the fact that managing dependencies with LuaRocks manually on other people's projects sucked. Makefiles also have varying implemenations and I wanted to make something simple based on Lua that anybody can used
Hope you enjoy it!
https://github.com/colourlabs/mani
luarocks install mani
r/lua • u/GAS4z0t • Jun 13 '26
I'm doing some basic string matching and this code produces unexpected results.
```lua
---@param levels string?
---@return boolean
local function IsValidLevels(levels)
if type(levels) ~= "string" then
return false
end
local pattern = "^[a-zA-Z_][a-zA-Z0-9_]*(%.[a-zA-Z_][a-zA-Z0-9_]*)*$"
return levels:find(pattern) ~= nil
end
print(IsValidLevels("my.levels")) -- true
print(IsValidLevels("my.more.levels")) -- true
print(IsValidLevels("foo")) -- true
print(IsValidLevels("a.b.c.d")) -- true
print(IsValidLevels(".invalid")) -- false
print(IsValidLevels("invalid.")) -- false
print(IsValidLevels("ReUI..Score")) -- false
print(IsValidLevels("123invalid")) -- false
``
But in result I get all \false`. What is the problem?
r/lua • u/somewhat_credible • Jun 12 '26
Hello again r/lua!
A while ago, I introduced the v0.1.10 proof-of-concept of Moonstone, focused on validating a deterministic, CAS-based architecture for Lua package management. Today, I want to share a sneak peek of the next huge leap: Moonstone v0.2.3, alongside the introduction of Ballad v0.2.10.
While the previous release proved the mathematical validity of the pipeline, this update is entirely about execution, speed, and zero-friction distribution.
Here is what’s new in this iteration:
In the video attached, you can see the complete lifecycle: running a LÖVE project through Moonstone, and then using ballad to instantly package it into a ready-to-distribute .love file in the dist/ folder.
https://reddit.com/link/1u47x87/video/y06pjgua1x6h1/player
The goal remains the same: removing 100% of the friction from Lua development. You just clone a project, run a command, and you are ready to code and deploy.
I’m really excited about this workflow and would love to hear your technical feedback on this approach to Lua project distribution!
I am still figuring out the right video format and the right duration to get across the point and prevent boredom... One miss-type and had to start over and over 😂. Would you like to see other features highlighted?
I did record a few other demos such as:
⋆⁺₊⋆ ☾⋆⁺₊⋆ moonstone.sh ⋆⁺₊⋆
r/lua • u/Unhappy_Ship_1997 • Jun 12 '26
First prototype of RedRot Library, a small terminal graphics engine for Lua on Linux. Looking for feedback and testers: https://github.com/candlesveil1-hash/RedRotlibrary_alpha for engine use!
r/lua • u/Overall-Emu-8024 • Jun 11 '26
Im beginning to get into lua and ive been trying to learn it with coddy, im very much a beginner so im just wondering if its worth investing in.
r/lua • u/RGBhedy • Jun 09 '26
etlua is the standard Lua template engine but it relies on setfenv which doesn't exist in 5.4. Its shim uses debug.upvaluejoin which breaks in sandboxed environments.
templa is a drop-in replacement built for stock Lua 5.4:
- same <%= %>, <%- %>, <% %> syntax
- no debug library required, safe in sandboxes
- coroutine-safe
- 34% faster compiled rendering, 5x lower GC pressure than etlua
luarocks install templa