Lua - Reddit – Telegram
Lua - Reddit
30 subscribers
279 photos
31 videos
4.23K links
News and discussion for the Lua programming language.

Subreddit: https://www.reddit.com/r/lua

Powered by : @r_channels & @reddit2telegram
Download Telegram
Can someone help me learn lua?

I'm new to coding and have more or less no idea how to noscript. If anyone could help me it would be greatly appreciated

https://redd.it/1lgpqmv
@r_lua
Can someone please help me if they know how the heck I can find this issue with my code for a mod im making for balatro? (the most coding experience i have is Scratch so bear with me lol) Code is below
https://redd.it/1lhlfwy
@r_lua
RN07 Maze-plan-(abandoned)

12:31pm 25/4/25 Just watched 'They cloned Tyrone'. Well I think I want the floor to be a bunch of mazes, like, going down, like an inverted climb, but a different shape of hallway collections each floore, I think that would be a nice way to challenge myself, after all, it wouldn't be too stressful a mission to complete a level each play, would it? It only has to be walls too, not neccessarily ceilinged, and any new ideas can fall to the next level, and then each floor has an entrance and exit, but also it fills the gap, to an extent, doesn't it? So it'll look nice from the outside, and on the inside it's a classic, but it remains then to accept the cliche and grind it from the first, and maybe a few good designs can trickle back up. I got the idea from this carpet pattern the protagonist is dragged by after he's shot in the film I just watched, it's a tesselation of octagonal spaces linked to neighbours, and disjoint encirling ones, bright yellow on black, and it's easy enough, because lets' face it, this multi-level shopping mall stuff is way out of my reach if I'm doing all this philosophizing. I should even do up a plan beforehand, with the floorspace included. But that's next week, or something, because I have had enough of it this week, after spilling my guts and making a show of it to D____. Besides, just a floor each session, that's reasonable, that's the way these things are meant to be played aren't they, I mean, when you clearly aren't Mr. Goodhope saving the damsel and saving the world. Even just a few starter levels would be right, a right job. Sheesh, I am f***ing exhausted.


On the other hand, I've also just downloaded some 'Alien' game and want to check it out and see if it works. Man I'm so goshdarn decadent. I don't know what's more evil, the building or the playing. I mean, what in tarnation are we gonna make that is actually a genuinely good thing, because I can't get away from the meat either when I'm deep in the work, and I don't want to be all taking these offerings against my style of personality development, my social enquiries, my open book ethical standard of discourse, wow there are so many good things I have to say about myself. But then again, the question is what makes you a good person, because it's like, you can do a good thing, or you can have a good thing, but something I haven't tried is this Alien game and to be honest, it's probably the best experience, but am I going to be able to play it the way I want or am I just going to be yo-yo-ing between that and the build and then just decide that it's all meaningless? How do I know the aliens are bad? How do I know I'm going to be sprinting around with loads of cavalry all day with some rad skins in space? But I mean, I don't do skins, do I? I buy skins, but I don't make them. I don't have a skin system, I mean, and I never did, but someone is having to smooth it all out for everyone else, and maybe I know enough about the stones anyway to be able to look at literally anything else, but then obviously there are a few questions I should ask, perhaps in the build I do, like do I really think that it's 'all skins'? Could the universe be 'just skins'? I mean that's like saying it's 'all atoms'. but, yeah, it is, but there's patterns of nature too. It's just, in nature there are levels of patterns all the way down to the atoms, but in games it's no longer a physical level, and the naive approach is punished with existential angst. You think you are a master of alchemy and substance but you still have to beg for the g****, because you ... you can't even wrap up a level, never mind a skin of a cloak and dagger celebrity. But if you want to go down the road of skin acknowledgement there's a rich tapestry of delusion that might make your world for you, all you have to do is be honest and subscribe to that 'theory of skins' and write your damn thesis in the world and see how much discord it causes amongst the locals who have lived in those places for a long time. Like, does anyone really want to get into arguments about
it with you, I mean you're so softly spoken. Go back to your stones.

Edit(23.6.25) It was just a layer of rush. Then RN06 was to produce chardust, and paths through chunks. RN05 will be making it pass for the ages, with some closure.

If anyone would like to help, answer this:
It would be ideal if sketches made with the chalk, or some future chalk, on a block could stay with it when dug to the inventory for later re-placement. So you could just sketch whatever textures you want, and leave them somewhere for later placement as though they were already part of the registered node list.

I also have to include
in chalk/canvas.lua[Ln156-173]: instruction to not apply this draw function when bitmap position is within half the duster's patch width from a surface's edge. It has to check the location of the crosshair for being less than scrubbing distance for the boundary etches, and end the function, so that item does not initiate error sequence. Otherwise I have to bear in mind the repercussions while using the duster in [RSWO][a]
[a]:https://github.com/flowingpoint/RSWO

https://redd.it/1liox5e
@r_lua
Here we go!!! I hope i don't quit like everything i tried in my life. (Any Advice is welcome. I want to finish something)
https://redd.it/1ljtsgh
@r_lua
Didn’t expect to use Lua for embedded dev,now I’m using it on microcontrollers

I always thought Lua was just for game noscripting or tweaking config files, didn’t even know people were using it to control hardware. Recently tried it out on an esp32 (was just playing around with IoT stuff) and was surprised how smooth it felt. I wrote Lua code in the browser, pushed it straight to the device, and got a working UI with MQTT + TLS in way less time than it would’ve taken me in c.

Didn’t need any local installs, toolchains, or compiling, just write + run.

Kinda wild that something this lightweight is doing so much. Curious if anyone else here using Lua in embedded or low-resource environments? Would love to see what tools/setups you’re using.

https://redd.it/1ljynal
@r_lua
I want to learn lua as my first language

If you could give me tips and like ways to do it in a hands on way that would be nice

https://redd.it/1lkjhkq
@r_lua
No recoil superlight 2

# Can someone help me in creating a "No Recoil" Script for Logitech superlight 2?

https://redd.it/1ll4r82
@r_lua
Lua Test and Automation Framework (TAF)

I am an Embedded Firmware Engineer and a few months ago my friend showed me a Robot Framework his company uses for writing end-to-end tests for the embedded devices.
I was speechless. Let's just say that I did not like it :)

So I decided to write a single tool that could:

run fast unit-style tests and longer integration tests,
talk to embedded boards over serial and drive browsers with WebDriver,
print pretty TUI dashboards in the terminal without heavyweight IDEs,
let me noscript everything in a high-level language but still drop to C when I need raw speed or OS access.

so I kindly present TAF (Test-Automation Framework).

---

### Feature list

| Feature | TL;DR |
|---------|-------|
| Lua 5.4 test files | Dead-simple taf.test("name", function() … end) syntax; hot reload; no DSL to learn. |
| C core | The harness itself is a ~7 K LOC C binary → instant startup, tiny footprint. |
| Serial module | Enumerate ports, open/close, read_until() helper with timeouts/patterns – perfect for embedded bring-up logs. |
| Web module | Thin WebDriver wrapper (POST/GET/DELETE/PUT) → drive Chrome/Firefox/Safari from the same Lua tests. |
| Process module | Spawn external procs (taf.proc.spawn()), capture stdin/stdout/stderr, kill & wait – good for CLI apps. |
| TUI dashboard | ncurses fallback (or Notcurses if available) – live view of “current test, current file:line, last log entry, pass/fail counter”. |
| Defer hooks | taf.defer(fn, …) to guarantee cleanup even if an assert() explodes. |
| Pluggable logs | Structured JSON log file + pretty colourised console output -> pipe into Grafana or just cat. |

---

### Quick taste (Serial)

local taf = require("taf")
local serial = taf.serial

taf.test("Communicate with GPS Device", {"hardware", "gps"}, function()
-- Find a specific device by its USB product string
local devices = serial.list_devices()
local gps_path
for _, dev in ipairs(devices) do
if dev.product and dev.product:find("GPS") then
gps_path = dev.path
break
end
end

if not gps_path then
taf.log_critical("GPS device not found!")
end

taf.log_info("Found GPS device at:", gps_path)
local port = serial.get_port(gps_path)

-- Ensure the port is closed at the end of the test
taf.defer(function()
port:close()
taf.print("GPS port closed.")
end)

-- Open and configure the port
port:open("rw")
port:set_baudrate(9600)
port:set_bits(8)
port:set_parity("none")
port:set_stopbits(1)

taf.print("Port configured. Waiting for NMEA sentence...")

-- Read until we get a GPGGA sentence, with a 5-second timeout
local sentence = port:read_until("$GPGGA", 5000)

if sentence:find("$GPGGA") then
taf.log_info("Received GPGGA sentence:", sentence)
else
taf.log_error("Did not receive a GPGGA sentence in time.")
end
end)


---

### Where it stands

Works on macOS and Linux (Windows native support is in progress, WSL should just work).
Docs live in the repo (docs/ + annotated examples).
Apache 2.0 licence.

---

### Road-map / looking for feedback

Parallel test execution (isolated Lua states + fork() / threads).
Docker/Podman helper to spin up containers as ephemeral environments.
Better WebDriver convenience layer: CSS/XPath shorthands, wait-until helpers, drag-and-drop, screenshots diffing.
Pre-built binaries via GitHub Actions so you can `curl | sh` it in CI.
TAF self test (Test TAF with TAF)

If any of this sounds useful, grab it: <https://github.com/jayadamsmorgan/taf> (name collision with aviation “TAF” accepted 😅). Star, issue, PR, critique – all welcome!

Cheers!


https://redd.it/1ll9u3u
@r_lua
lua classes and complex numbers!

I wrote a small (60 loc) lua system that implements classes, and wrote a complex number class using it (and 800 lines of tests), and a fractal renderer (in roblox) with it
github link: https://github.com/WaffleSpaghetti/lua-classes-and-complex-numbers/tree/main
game link: https://www.roblox.com/games/85562596659593/lua-classes-complex-numbers-burning-ship-fractal
(though the game is more of a tech / use case demo)
hope someone finds this useful or cool :D

https://redd.it/1llewlz
@r_lua
Connecting via Websocket to a server.

So as a quick fun project, I wanna develop a mod for the game "Balatro" coded in lua with LÖVE2D, using the SteamModded framework and the lovely injector. Recently I've been hitting a wall. I need to connect as a client to a server via websocket and be able to recieve and send json messages. I have looked on the internet for solutions but I wanna ask here. (Btw I do know the syntax as its easy to adopt from python, and i do understand lua code).

- I've looked at lua-webhooks, but for a client I needed the ev module (for events it seems?) and for the love i cant find out how to get that module.
- I've looked at another Balatro Mod that adds multiplayer and uses sockets, but that's all i could find out. I am unsure what it does repo.
- And I've found lua-http, but i couldnt find any big documentation on it.

Help appreciated!




https://redd.it/1llm1u9
@r_lua
For a beginner how long would it take to learn the basics of Lua?

im just wondering how long its gonna take me to learn the basics of Lua as a newbie. Thanks!

https://redd.it/1llyiop
@r_lua
LuaDroid: why is some of the noscript not displaying in the output?

BACKGROUND ON THE OP:
I am quite new to lua. I've only been learning for a few days and I can grasp the basic principles of it. I have prior knowledge about coding and basic ideas as I'd learned most of python a few years back (I have forgotten nesrly all of what I had learned though).

I've been using roblox studio to learn when I'm at home but when travelling, I use LuaDroid. It is quite useful and, while I obviously can't practice stuff that need a 3d world and things that roblox studio has and LuaDroid doesn't, I can still practice if statements, maths, for and while loops, etc.

So anyways this is the issue: the noscript after line 61 (apart from comments because they don't appear anyway) just won't show up in the output. I've made a few functions after line 61 and then called them for use later but they aren't displayed in the output. I just don't understand why so someone please help me!

I'll paste my coding and what shows up in the output below. Also please tell me if I need to include more information about this because I don't know how much information you'd need to be able to tell me what I've done wrong.




Here's all of my coding (don't mind some of my word choices... hehe):




print("what the john is this")
-- thats the only thing i know how to do
-- how do i access lessons help
-- im cooked
print("im cooked")
print("heheheharr")
print("imma watch a tutorial 1 sec")

-- WRITTEN ON: idk the day i got this app-----

local function addOneLol(addOneTo)
resultA = addOneTo + 1
print(addOneTo, "add one equals", resultA)
return resultA
end

addOneLol(6)
addOneLol(100)

local function timesFive(multiplyMe)
resultM = multiplyMe 5
print(multiplyMe, "times five equals", resultM)
return resultM
end

timesFive(210)
timesFive(0.2525)

if timesFive(200) == 1000 then
print("guys 200 times 5 is 1000 no way")
else
print("news flash: my life is a lie")
end

local sigma = 0

for skibidi = 1, 10, 1 do
sigma = sigma + 1
print(sigma)
if sigma >= 5 then
print("yay")
end
end

local function countToFive()
for chad = 1, 1 do
print("1")
print("2")
print("3")
print("4")
print("5!")
end
end

local rizz = 1
while rizz < 6 do
print("this should be displayed 5 times")
rizz = rizz + 1
return rizz
end

-- uhh everything past this line doesnt work T-T
-- im actually gonna crashout holy moly rawrrrrr

countToFive()

local function xTIMESy(x, y)
resultT = x
y
print(resultT)
return resultT
end

xTIMESy(9, 12)

-- WRITTEN ON: MONDAY 23RD JUNE 2025-----

trueORfalse = true

local fuction fiftyfifty()
if trueORfalse then
print("its true")
for i = 1, 10, 1 do
print("yay")
end
end

fiftyfifty()

-- WRITTEN ON: TUESDAY 24TH JUNE 2025-----





Here's what shows up in the output:





what the john is this im cooked
heheheharr
imma watch a tutorial 1 sec
6 add one equals 7
100 add one equals 101
210 times five equals 1050
0.2525 times five equals 1.2625
200 times five equals 1000
guys 200 times 5 is 1000 no way
1
2
3
4
5
yay
6
yay
7
yay
8
yay
9
yay
10
yay
this should be displayed 5 times

https://redd.it/1lm49e2
@r_lua
Recruitment Application

Greetings,
I am assembling a dedicated Roblox development team comprising 3 Developers and 3 Designers.
If you are passionate about creating high quality projects and possess strong skills in your field, I invite you to join us.

Regarding payment: Once the game is completed, all profits and interests will be fairly split among the team members.

Please send me an email on : david.business069@gmail.com to express your interest or request more information.

Looking forward to collaborating with talented individuals.

Best regards

https://redd.it/1lmauyp
@r_lua
Lua on microcontrollers. Surprised how far it’s come

Been mostly using lue for small noscripting stuff over the years, config files, quick automation etc. Always loved how clean it feels but never thought of it as a serious option for embedded devices.

Recently tried out a setup where you run lua code directly on an esp32 and it honestly blew me away. Like full noscripting, GPIO access, MQTT, TLS, even OTA updates and all of it handled from a browser based IDE. Didn’t expect that level of capability from such a tiny chip running Lua.

Curious if anyone else here is experimenting with Lua on constrained devices? I know NodeMCU is a thing, but this felt a bit more full featured.

https://redd.it/1lnn2q9
@r_lua
New to Lua, Code won't Print, Help (Visual Studio Code)

https://preview.redd.it/g1i90ylu90af1.png?width=1920&format=png&auto=webp&s=731fa3a147994ad3b8f4fd615dfb7e305292afc0

So I'm still new to Lua, And I'm using VSCode to do my Lua Coding, I'm just wondering why my Lua Code refuses to print in the Output Console, Can someone answer me that?

https://redd.it/1lo04s5
@r_lua
realistically, how much faster is binding globals to a local? is it even noticeable?
https://redd.it/1lpad4q
@r_lua