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
I'm trying to start coding and i need help with luau

I have never coded before ( excluding scratch if that's coding). And I would like to begin coding in roblox studio. but I don't know at all what the commands are ( or whatever its called). can somebody help me by putting a list with all the commands and what they do? I think I can figure out the rest on my own. Thx

https://redd.it/1kk4u67
@r_lua
vscode/vscodium extensions outdated?

Totally new to programming. Are a lot of the lua extensions in vscode outdated? When I go to debug it often throws up errors I don't get in zerobrane studio, especially after user input. Is there a relatively foolproof extension I can install for vscode/vscodium?

https://redd.it/1kkatdm
@r_lua
How long did you take for you to become fluent in Lua?

I'm taking classes for python and only a little fluent in python. After I get fluent in python I will begin with lua because the language is faster. I will still use python.

https://redd.it/1kkltld
@r_lua
expected identifier when parsing expression, got ')'

new to lua and don't know where i am going wrong




game.Players.PlayerRemoving:Connect(function(player)

do

for _, eggy in game.Workspace.poor:GetChildren() do

if not eggy:GetAttribute("Owner") then continue end

\-- the plot is owned by a player

if eggy:GetAttribute('Owner') \~= player.UserId then continue end

\-- we have found the correct plot

eggy:SetAttribute('Taken', nil)

eggy:SetAttribute('Owner', nil)



print('eggy has been destroyed by ' ..player.Name..'!')

break

end

end)

https://redd.it/1kkrtga
@r_lua
Make my project compatible with lua 5.x, or just luajit?

Hello everyone,

I'm currently developing a template language, “Plume”, which translates to Lua.

Originally, I had planned to make it compatible with Lua 5.x, but recently I've been hesitating.

Advantage: it can be used in any Lua environment without any hassle, and use any lib written in lua.

Disadvantage: extra burden of writing and maitienting the code, but in real life it's doable. On the other hand, you run the risk of having Plume libraries that are incompatible with each other, as they are written with different versions of lua... And maybe, for a templating language, having an “official” environment (in this case, luajit) is more interesting than being plug and play.

What do you think? Any other arguments? I'll have to make a choice, but I'm stumped \^\^'.



https://redd.it/1kl005h
@r_lua
preprocessor in lua

I’ve been thinking about adding a simple attribute‑based “preprocessor” to Lua—something that runs at compile time to transform or wrap functions. You could use it for things like inlining tiny helpers, optimization ease of development etc.

I know Lua tends to favor minimalism and explicit idioms, so I’m curious whether this would feel too “un‑Lua‑like.” On the other hand, I think it could clean up repetitive boilerplate and boost performance in hot paths.

Below is a sketch of what the syntax might look like, along with some usage examples:

-- (1) Inline small functions into call sites
\@inline
function add(a, b)
return a + b
end
-- After preprocessing: calls to add(a, b) become (a + b) directly.

-- (2) Benchmark execution time of a function
\@benchmark
function heavywork(n)
-- simulate work
for i = 1, n * 1e5 do end
end
-- At runtime, heavy
work(10) prints: heavy_work took 0.012s

-- (3) Memoize pure functions automatically
\@memoize
function fib(n)
if n < 2 then return n end
return fib(n-1) + fib(n-2)
end
-- fib(30) runs in O(n) instead of O(2^n).

-- (4) Register compile‑time callbacks
\@callable
function dosomethingawesome()
print("Registered at compile time")
end

-- (5) Retry on error (e.g., network calls)
\@retry(3)
function fetchdata(url)
return http.get(url) -- might error
end
-- fetch
data retries up to 3 times before finally erroring.

-- (6) Initialization hook
\@init
function setupenvironment()
print("Environment initialized!")
end
-- runs once, when the noscript is loaded.

-- (7) Documentation and metadata
\@doc("Calculates the nth Fibonacci number efficiently.")
\
@todo("Add tail‑recursive version")
\@tag("math", "performance")
\
@deprecated("Use fibfast instead")
function fib(n)
-- …
end

What do you think? I’d love to hear your thoughts and any ideas for useful annotations I haven’t listed!

https://redd.it/1kma10y
@r_lua
Confused about this noscript

So I found this noscript in this subreddit but it doesn't really work for this 3D model I have. I tested it with a normal part and it works. So my question is are parts and 3D models the same or do I have to do something else for this to work.

Heres the noscript: https://devforum.roblox.com/t/how-would-i-go-about-part-always-facing-player/1182594/2

When I put the noscript for my 3D model it doesn't work but it does if its a part.

https://redd.it/1kmysv0
@r_lua
New to Lua! Need code review to my fzf in lua

Hello I am pretty new to learning lua. I have started learning by creating fzf from scratch in lua. Although still not completed, can anyone review my code quality add tell me if its upto the lua standards or not

you can check my repo on https://github.com/PyDevC/fzf.git

https://redd.it/1knelrd
@r_lua
I never coded. I’m trying to learn lua throguh immersion on Reddit.

im Making a game. Where You click a button, that button gives you a coin, that coin can be transferred as bitcoin. Give me lua codes!

https://redd.it/1knvut4
@r_lua
Route No.7 of RSWO Order
https://redd.it/1knw01c
@r_lua
Looking for Developers to Build a Powerful FiveM Anti-Cheat Team

Hey everyone,
I’m currently working on building a new, advanced FiveM Anti-Cheat system that will compete with top names. The goal is to create a complete system with:
• Powerful client-side and server-side detection
• Trigger & event logging
• Cheat bypass detection
• Ban system with SQL logging & Discord webhook logs
• Clean and modern GUI
• Optimized performance and obfuscation
• Full config system and export-ready files

I’m looking for experienced people in the following areas:
• Lua development (FiveM client/server)
• C++ (for DLLs or native-based detection)
• SQL & Discord integration
• UI design for NUI menus
• Testing & exploit research

This project is serious and will be released with a licensing system. I’m open to profit-sharing if you’re dedicated and want to build something long-term.

If you’re interested, feel free to DM me or contact me on Discord
Discord: wayzedev

Let’s build the most secure anti-cheat together!

https://redd.it/1ko9f6n
@r_lua
Need to find a LUA dev

Hi! I need to find a lua dev to make a fast and really simple noscript if anyone can do it for free!

Discord: hassantaxi

https://redd.it/1ko92x7
@r_lua
project setup with busted

I would like proposals what like a project setup could/should look like.

I got zerobrane studio and want to use busted for testing. i want to be able to build an artefact without tests. luarock is out of question as I am targetting a specific game extension.

is there anything in zerobrane supporting this? or getting close to it? I can well setup shell noscripts, but a more integrated approach would be preferred.

https://redd.it/1koq15g
@r_lua
Lua for Pokemon Pinball

Would anyone know know how to write a Lua noscript to the makes the entire playfield visible in pokemon pinball RS?

https://redd.it/1kot5zn
@r_lua
CRC32 implementation help

I'm developing a Lua interpreter with the Lua C API and want to implement CRC32 hashing. It kind of works, however, when I try to calculate the CRC32 hash of "test" it returns -662733300 instead of 3632233996 as an integer and FFFFFFFFD87F7E0C instead of D87F7E0C as a hexadecimal value. As a result my CRC32 hash doesn't match with the one generated in my interpreter. This is my C code for the Lua function, I'm using zlib for the crc32 function in C:

static int luacrc32(luaState L) {
uLong crc = crc32(0L, Z_NULL, 0);
const char
str = luaLcheckstring(L, 1);
uInt len = strlen(str);
crc = crc32(crc, (const Bytef *)str, len);
lua
pushinteger(L, crc);
return 1;
}

https://redd.it/1kowq1s
@r_lua
Lua for gamedev and type system

i've been trying Löve and (first game framework that i have tried) and its sucks for me in some ways. Doing everything in keyboard is good less abstractions but it does not feel quite well cause of lsp problems (i assume) maybe it's just Lua being super dynamic, but I configured Lua LSP with LÖVE extensions and tested it on some sample projects I grabbed from GitHub. The code completion is kind of broken function arguments don’t show up, type info is missing, and it just doesn’t feel reliable. so i still want the game framework style development and i still want tightly integrated types.

Compared to Godot which have good integration good type system many tools but i wanna try new things and this type situation makes it rougher for me

Am I missing something obvious?

https://redd.it/1kozn33
@r_lua
Lua linux executable

Hi! I’ve been having trouble creating a portable executable that doesn’t require installation. Here’s my project and the AppDir folder.

Hasheito

├── conf.lua

├── Hasheito.love

├── icon.png

├── Logica.lua

├── lua_modules

│   ├── lua_modules.lua

│   └── sha2.lua

├── main.lua

└── suit

├── button.lua

├── checkbox.lua

├── core.lua

├── docs

│   ├── conf.py

│   ├── core.rst

│   ├── gettingstarted.rst

│   ├── index.rst

│   ├── layout.rst

│   ├── license.rst

│   ├── Makefile

│   ├── _static

│   │   ├── demo.gif

│   │   ├── different-ids.gif

│   │   ├── hello-world.gif

│   │   ├── keyboard.gif

│   │   ├── layout.gif

│   │   ├── mutable-state.gif

│   │   ├── options.gif

│   │   └── same-ids.gif

│   ├── themes.rst

│   └── widgets.rst

├── imagebutton.lua

├── init.lua

├── input.lua

├── label.lua

├── layout.lua

├── license.txt

├── README.md

├── slider.lua

├── suit-0.1-1.rockspec

└── theme.lua

Hasheito.AppDir/

├── AppRun

├── Hasheito.desktop

├── hasheito.png

└── usr

├── AppRun

├── bin

│   └── Hasheito

├── lib

│   ├── lfs.so

│   ├── libbrotlicommon.so.1

│   ├── libbrotlidec.so.1

│   ├── libfreetype.so.6

│   ├── liblove-11.5.so

│   ├── libluajit-5.1.so.2

│   ├── libmodplug.so.1

│   ├── libmpg123.so.0

│   ├── libogg.so.0

│   ├── libopenal.so.1

│   ├── libpng16.so.16

│   ├── libSDL2-2.0.so.0

│   ├── libtheoradec.so.1

│   ├── libvorbisfile.so.3

│   ├── libvorbis.so.0

│   └── libz.so.1

├── license.txt

├── love.desktop

├── love.noscript

└── share

└── lua

└── 5.1

├── lua_modules

│   ├── lua_modules.lua

│   └── sha2.lua

└── suit

├── button.lua

├── checkbox.lua

├── core.lua

├── docs

│   ├── conf.py

│   ├── core.rst

│   ├── gettingstarted.rst

│   ├── index.rst

│   ├── layout.rst

│   ├── license.rst

│   ├── Makefile

│   ├── _static

│   │   ├── demo.gif

│   │   ├── different-ids.gif

│   │   ├── hello-world.gif

│   │   ├── keyboard.gif

│   │   ├── layout.gif

│   │   ├── mutable-state.gif

│   │   ├── options.gif

│   │   └── same-ids.gif

│   ├── themes.rst

│   └── widgets.rst

├── imagebutton.lua

├── init.lua

├── input.lua

├── label.lua

├── layout.lua

├── license.txt

├── README.md

├── slider.lua

├── suit-0.1-1.rockspec

└── theme.lua

The last error was:

Error

//Logica.lua:3: module 'sha2' not found:

no field package.preload['sha2'\]

no 'sha2' in LOVE game directories.

no file 'sha2' in LOVE paths.

no file './sha2.lua'

no file '/usr/share/luajit-2.1/sha2.lua'

no file '/usr/local/share/lua/5.1/sha2.lua'

no file '/usr/local/share/lua/5.1/sha2/init.lua'

no file '/usr/share/lua/5.1/sha2.lua'

no file '/usr/share/lua/5.1/sha2/init.lua'

no file './lua_modules/sha2.lua'

no file './sha2.so'

no file '/usr/local/lib/lua/5.1/sha2.so'

no file '/usr/lib/lua/5.1/sha2.so'

no file '/usr/local/lib/lua/5.1/loadall.so'

Traceback



[love "callbacks.lua"\]:228: in function 'handler'

[C\]: in function 'require'

//Logica.lua:3: in main chunk

[C\]: in function 'require'

main.lua:3: in main chunk

[C\]: in function 'require'

[C\]: in function 'xpcall'

[C\]: in function 'xpcall'


I hope you can help me guys!

https://redd.it/1kp1f64
@r_lua
Animations broken and I can't figure out why
https://redd.it/1kp4mrh
@r_lua