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

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

Powered by : @r_channels & @reddit2telegram
Download Telegram
What are some of your problems with lua?

Love2d and other libraries are welcome but just say what library your talking about

https://redd.it/1q1euey
@r_lua
Is Lua the right step to learn how to code a roblox game?

So, I want to learn how to code so I can make my own story game on roblox. Yet, I am not sure if I am going in the right step or not. Since I heard that Roblox game used Lua or a variation of it.

If it is, what resources should I use to learn lua more, since I am finding coddy tech frustating to use and learn from. Since I would type it thinking I got it correct but then I am stuck and the ai help doesn't work for me. (A human imput would be better since I normally find when a human who has experince can normally find out what I did wrong)

If this isn't the correct step then what should I do instead?



https://redd.it/1q15r42
@r_lua
I built a Lua/Luau obfuscator with control-flow flattening and anti-tamper - looking for feedback

I’ve been working on a Lua/Luau obfuscator as a side project.

It’s not just a renamer - it includes:

string encryption
control-flow flattening
integrity-bound API indirection
environment hardening (anti-hooking)

Here’s a small before/after example:
*https://pastebin.com/raw/GNFGha8e*

I’m mainly looking for feedback or ideas on what could be improved.

If anyone’s curious, I have a Discord where I post builds and updates.

https://redd.it/1q0gbj8
@r_lua
Can I learn lua with dyslexia

I seen bits of lua and it looks fun but I have dyslexia and have a hard time with long words so I was wondering if lua may not be the best thing for me to try to make a hobby and if so where is the best place to try to learn lua with like hand on. Because I dont want to watch a video that is just going to tell me how to do anything. I learn better well doing it myself as well. And one other thing how long does it take the average person to learn lua?

https://redd.it/1q02ksm
@r_lua
City

Estou construindo uma cidade para FiveM e estou procurando um desenvolvedor de jogos interessado em ajudar a construir este projeto.

Não posso pagar no momento, mas ofereço participação no projeto, crédito/nome no servidor e total liberdade criativa.

Ideal para um desenvolvedor que quer construir um portfólio e crescer junto.

Requisitos:

Conhecimento pelo menos intermediário de Lua

Sou do Brasil (falo português, mas inglês está tranquilo) Estou construindo uma cidade para FiveM e estou procurando um desenvolvedor de jogos interessado em ajudar a construir este projeto.

Não posso pagar no momento, mas ofereço participação no projeto, crédito/nome no servidor e total liberdade criativa.

Ideal para um desenvolvedor que quer construir um portfólio e crescer junto.

Requisitos:

Conhecimento pelo menos intermediário de Lua

Sou do Brasil

https://redd.it/1q39aft
@r_lua
Vectarine: A game framework for ultra fast prototyping

I really like Love2D for making games, but it is annoying to export on the web. I like participating in game jams on itch.io and having a web version for people to test is a must. Moreover, I need to restart my game when I make a change to see it which slows me down where coding. That's why I made https://github.com/vanyle/vectarine/ It is a hybrid between a framework and a game engine.

You write your game in Lua (or Luau) and as you save, you see changes instantly. Also, I've automated the export process to make is super simple + added a bunch of other helpful tools to simplify debugging

The engine's interface looks like this:

https://preview.redd.it/tbochxvdcf9g1.png?width=1824&format=png&auto=webp&s=8f3178b29eadae72982997de4ef4a8d3ed4111e5

I'm open to feedback! There is a lot missing right now like Joystick support but I want to improve it over time.

https://redd.it/1pvo97d
@r_lua
[GLUA] Bizarre Bug Involved Respawns With a Specific Team

I will preface this with the fact that I know r/lua is not exactly the most relevant subreddit for glua-related issues, however since the r/glua moderators appear to have gone missing for 4 years and the post I made to r/gmod has garnered no response, I decided to post here.

I'm creating a hide-and-seek type gamemode. Whenever the round starts, I have all players respawn, blind and lock the seeker, and spawn an ammo resupply in front of them. This all worked as intended previously, but after a series of additions to make spectating work and preventing players from respawning during the round, the seeker's respawn is bugged, and they'll be respawned in the same position (but not same angle) they were at prior to respawning. The ammo crate, however, spawns in the correct spawn (at an info\_player\_start), and for one tick the seeker appears to spawn in the correct spot. Due to this being a hide-and-seek gamemode, this is obviously an issue.

For where this bug occurs, the players are respawned in a function that handles all logic for when the round should start, which is called from a think hook keeping track of the timer and when the round should begin and end. Prior to respawning, the seeker is selected, players are assigned teams, and a message is sent to the client to open the weapon select menu.

Both the `beginRound` and `selectTeams` functions are shown before, I believe it should be self-explanatory enough.

-- begins the hiding phase of the round
local function beginRound()
round_status = 1
roundStartTime = lobbyEndTime + HideTime
updateClientStatus()
print("Round Status: "..round_status)

local plyrs = player.GetAll()
local alive = 0

-- old code from when I first worked on this, perhaps can be used to adjust time based on number of players
for _,v in pairs(plyrs) do
if v:Alive() then
alive = alive + 1
end
end

-- set up Players
selectTeams(plyrs)
giveWeapons()

for _,ply in pairs(plyrs) do
-- bug occurs with this call to spawn the players
ply:Spawn()
print(ply:GetPos())

if ply == seeker then
ply:Lock()

net.Start("BlindKiller")
net.Send(ply)
end
end

-- creates the resupply crate
createResupply()

timer.Simple(0.1, function()
print(seeker:GetPos())
end)
end

local function selectTeams(plyrs)
local seekerNum = math.random(1, #plyrs)
-- tried respawning the seeker both prior and after the seeker variable is assigned - both failed
seeker = plyrs[seekerNum]
seeker:SetTeam(0)
seeker.Seeker = true

for _,ply in pairs(plyrs) do
if (ply ~= seeker) then
ply:SetTeam(1)
ply.Seeker = false
end
end
end

What's odd is that this bug does not happen for the hider and lobby teams, and furthermore when the seeker respawns after the round starts, they respawn normally. Attempting to respawn the seeker after they're selected but before they're assigned to the seeker team doesn't work. This bug also appeared before when I overrode the PlayerSpawn hook to add sandbox movement. Calling both `player_manager.SetPlayerClass` and `BaseClass.PlayerSpawn` would cause the same respawning issue. Removing my own implementation of the algorithm does not fix it this time. The hook that caused the issue previously is as follows:

function GM:PlayerSpawn(ply, transition)
player_manager.SetPlayerClass(ply, "player_sandbox_modified")
BaseClass.PlayerSpawn(self, ply, transition)
end

I also can not find any resources online talking about this issue as I have it. Nothing about "respawning where player was before respawning", or "player spawning in wrong position". I couldn't find any posts on forums,
Reddit, Steam, what have you, about this issue. Nothing with videos either, they're already scarce as they are and nothing dealt with player respawns. These posts are my last resort to try and fix this.

https://reddit.com/link/1q3gn37/video/i1buqkrfd9bg1/player

Here is a video showing the bug in action. I removed the blind effect on the seeker to make it more obvious what's happening. When the player spawns after the round starts, I had it print out the player's position. Then, after a 0.1 second timer, I print out the player's position again to show how it's different, suggesting the player spawns correctly for one tick before being moved.

I hope this is enough information to discern the cause of the bug. Any help is appreciated!

https://redd.it/1q3gn37
@r_lua
I need GUI Lib

Hello dear Lua community! I am searching for 3 days to find a GUI Lua library but i can't finded any. ChatGPT, Claude and other AI's can't find any. I found a GTK wrapper for lua called lgi but i can't find a guide to code on it. Please help me.
- Plz find a free-licensed lib.
> Löve is not for me. I need a generic library, not a game developing framework.
Thank you.

https://redd.it/1q3itu6
@r_lua
sqlite-vec (Vector Search in SQLite) version 0.2.4-alpha released

I've just released version 0.2.4-alpha of my community fork of sqlite-vec. It now features a binding for the Lua programming language.

Full details from CHANGELOG.md:

## 0.2.4-alpha - 2026-01-03

### Added

- Lua binding with IEEE 754 compliant float serialization (#237)
- bindings/lua/sqlite_vec.lua provides load(), serialize_f32(), and serialize_json() functions
- Lua 5.1+ compatible with lsqlite3
- IEEE 754 single-precision float encoding with round-half-to-even (banker's rounding)
- Proper handling of special values: NaN, Inf, -Inf, -0.0, subnormals
- Example noscript and runner in /examples/simple-lua/

https://redd.it/1q3kwik
@r_lua
The Hitchhiker's Guide to Making Lua's Indexing 0-Based Without Changing Its Source Code

To preface, I will state that I actually enjoy 1-based indexing. This is more of a thought experiment, and is very unlikely to be useful in production.
Also keep in mind that the code samples I provide are, likewise, going to be very far from the best implementation of doing such a thing.

The first and most obvious thing is that you will NEVER be able to make Lua 0-based (at least, internally) without changing the source. Now that that is out of the way, here is how you can pretend

It is possible to change indexing via metamethods, however, this post will not be about that technique.


ipairs \- The first thing that can be considered any sort of concern is ipairs. It, by its own definition, is 1-based, and thus to achieve this goal we will need to override it. Lua makes creating your own iterator function very easy, thankfully, and thus can be overridden by simply doing something akin to this:



ipairs = function(t)
local i = -1
local tMax = #t
return function()
i = i + 1
if i <= tMax then
return i,ti
end
end
end

Nearly every single function in table \- This part is potentially the most tedious. Every single one of these functions, of course, use 1-based indexing. There are two solutions to this (at least, that I can personally think of), with the easiest being to simply do the following, using table.insert as an example:

local oldTable = table
table.insert = function(list,...)
local args = {...}
if #args >= 2 then args1 = args1 - 1 end
oldTable.insert(list,args1,args2)
end

# and general table creation - These ones are bummers. For table creation, Lua fills arrays starting with 1, and this cannot be stopped. Likewise, the # will always return the table's size assuming 1-based indexing. Metamethods could be used to solve # (though, this adds the new issue of needing to things slightly more manually), however, there is nothing that can be done about the way Lua fills arrays. Despite this, for #, one could still make a more automatic solution, and that's declaring a simple size function going by a different name.

function size(t)
if type(t) ~= "table" then
return #t
end
local s = 0
while ts ~= nil do
s = s + 1
end
return s
end

These examples are not all that needs to be done, but these are the main things, to my knowledge.

https://redd.it/1q4eiis
@r_lua
Help deobfuscate/decrypt



Hello guys i know maybe this isnt allowed in the server but im new to lua code im using it in a game but someone gave me a noscript that i want to use but im not sure if it steal items from me so can someone help me in deobfuscating it so i can look into it?

https://hastebin.com/share/royositepu.swift

Thank you!!

https://redd.it/1q4nfq1
@r_lua
Noob starting on tic 80

I’m a full blown noob when it comes to anything related to programming and writing code but I’ve always wanted to fiddle with making games here and there and wanted to know:
Are there any good tutorials for absolute zero experience beginners (everything I find expects a little bit of knowledge)

Any tips or basic things I need to know going into it (for example I learned that lines of code need to be inside a function or something like that to run, or that you can write code outside of your original tic() function)

I’ve been using some random pdf I found on itch.io and it helped me get going but really I haven’t learned how to make anything new I guess. Everything is a 1 to 1 guide not a “here’s the basics and what you can do with it now make your own stuff” sort of deal
Anyways I’ve fiddled for 30 mins or so and just need some starter motivation and pointers

https://redd.it/1q7sh2p
@r_lua
This is a question from someone who knows nothing about Lua. In your opinion, what's the most efficient and effective way of learning Lua?



https://redd.it/1q6tbs1
@r_lua
Trying to use this code to mirror 2nd monitor in minecraft

So I found this video where a guy basically mirrored his second monitor irl to a monitor on minecraft. I figured out how to edit the part calling for what direction the monitor is in relation to the advanced computer. Now its attempting over and over but wont work. I think I need to set my monitor as a source but I dont know how to or what its called. Any advice?

https://github.com/TheArmagan/ccdesktopvideoserver

https://redd.it/1q63yve
@r_lua
I have fallen in love with luajit and is a shame that is so unrecognizable

Hi all, I've started this new job a year ago and our code base that work on is in lua. I never had any experience with it and I just thought it was a lesser version of python, now I think python is the lesser here.

What really made me fall in love was the moment I realized is all tables, packages? Tables, objects? Tables. Sugar syntaxes? Tables.

For me there is only a few languages that I care to like, if web then html,css,js; if performance or embedded then c/c++ and python for everything else. Now between I've seen how I was wrong, lua is better than python. Period. It merges the simplicity of code writing (no having to match vars type and returns, fixed memory, blabla) with the speed of C++ (because you can just import any fucking compiled library) like wtf lua should be way way way more used and advertised than python

https://redd.it/1q93ayy
@r_lua
I need a bit of help in my virtual studio code

i am trying to make it read 2 numbers from the input and then run the Pythagorean theorem on them but when i insert the 2 numbers it give me a random error cuz im a beginner

https://preview.redd.it/j28ffre11ocg1.png?width=609&format=png&auto=webp&s=1ae412a6b3c37ea35392981f1d7d43b4a9f67809

https://preview.redd.it/7av3v5841ocg1.png?width=414&format=png&auto=webp&s=9c6141f8f92a953f3d0c0827fee1fece98561f30

https://redd.it/1q9sbg0
@r_lua