Lua - Reddit – Telegram
Lua - Reddit
30 subscribers
278 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
Is stack a type of recursion?

Not sure if this is the best place to post so I apologize if its not.

I've been trying to get my head around recursion (big newbie to programming) & I'm a little confused about the course I watched putting stack, LIFO & recursion together as topics. To me, recursion sounded very specific to the way some functions are carried out, whilst stack & LIFO are the way your entire code is read/executed.

Are stack & LIFO types of recursion, or are they all just the way your computer runs code?

https://redd.it/1nyimlb
@r_lua
Develop WinUI3 applications in Lua (WIP - Preview Video)

Hi everyone,

Here is a preview video of a new LuaRT module I'm working on that brings WinUI 3 support to the LuaRT Windows programming framework : https://www.youtube.com/watch?v=ghx1MSfTA1w

This means you will be able to build modern Windows desktop apps using pure Lua, with full access to Fluent UI controls, thanks to LuaRT builtin object oriented programming capabilities and asynchronous Task object implementation.

No need for C++, .NET, or heavy frameworks.

Native WinUI 3 integration

Clean, expressive Lua syntax

Compatible with LuaRT static compilation and binary modules

Example from the video with dependencies statically compiled as a standalone executable : only 600kb, no other dependencies (even Microsoft.WindowsAppRuntime.Bootstrap.dll is not needed)

This is a big step toward making professional-grade UIs accessible to Windows Lua developers. I hope to release a first version soon.

You can find more about LuaRT, the Windows programming framework for Lua at https://luart.org


https://redd.it/1nzltj8
@r_lua
How to detect memory leaks when working with LuaJIT FFI?

What the noscript says.

I'm trying to use LuaJIT FFI to make tiny-ish games for my Miyoo Mini with SDL. The issue is that I have no clue how one would check for memory leaks. It is relatively straightforward with valgrind for compiled programs, but is there anything similar to use with LuaJIT?

https://redd.it/1nzm3td
@r_lua
Lua noscript not working for turret in stormworks

Hello everyone who is here i need to help with this code scanAngle = 0

function onTick()
local tx = input.getNumber(1)
local ty = input.getNumber(2)
local tz = input.getNumber(3)
local hasPlayer = input.getBool(1)

local yaw, pitch

if hasPlayer then
yaw = math.atan2(tx, tz) / math.pi
pitch = -math.atan2(ty, math.sqrt(txtx + tztz)) / (math.pi/2)
output.setBool(3, true)
else
scanAngle = scanAngle + 0.02
if scanAngle > math.pi then scanAngle = -math.pi end
yaw = scanAngle / math.pi
pitch = 0
output.setBool(3, false)
end

output.setNumber(1, yaw)
output.setNumber(2, pitch)
end
This code is for turret in stormworks its need to find a seat and start shooting error is not working

https://redd.it/1o11yv4
@r_lua
Require modules are unknown

Hello,

I’m working with lua/love 2d because I’d like to learn game dev, but I have an issue concerning the require of modules. For whatever reason, it always cast my variable containing the module as « unkown » even tho the module in question contain types.

I use Zellij with lazyvim as a dev environment and I already have lsp setup.
In VSCode for example, I don’t have issues when importing modules that contain types.

Anyone had the same kind of problem when using neovim/lazyvim and lua types?

Thank you.



https://redd.it/1o3be8o
@r_lua
Indexing table constructor: return {2,8}dice(2) ???

I know that you can make it work by putting parenthesis around the table, but why doesn't it work without the parenthesis?

-- works
return ({2,8})dice(2)

-- doesn't work
return {2,8}dice(2)

https://redd.it/1o51g7h
@r_lua
Need to Learn how to Lua Script For roblox basics

i need to know Lua noscripting to make some games pls give me relativley quick and easy ways to learn

https://redd.it/1o5574w
@r_lua
I made a noscript that automates “Please Donate” and earned 80k+ Robux in 2 weeks

Hey everyone,
I’ve been experimenting with automation inside Roblox’s “Please Donate” game and decided to build a small noscript to handle all the boring parts — keeping the booth active, refreshing messages, and thanking donors automatically.

After running it for a couple of weeks, I ended up earning over 80,000 Robux completely AFK. I honestly didn’t expect it to work that well.

I’ve cleaned it up, made it beginner-friendly, and documented how to set it up safely without breaking any Roblox terms. If you’re curious about the technical side or want to see a demo of how it works, feel free to DM me or ask questions here.

Not trying to spam or break any rules — just wanted to share what I built and see if others would find it useful.

https://redd.it/1o59u1d
@r_lua
SuperStrict the first "linter" written in pure Lua

Super Strict is a Lua library (compatible with Lua 5.1, 5.2, 5.3 and LuaJIT) that finds undeclared variables and other minor mistakes in your source code. Super Strict tests your Lua noscripts during loading using static analysis. Super Strict is very secure because it can be used without downloading, installing or running any pre-compiled binaries.

The source code is currently available on GitHub and the documentation is hosted on 2dengine.com

https://redd.it/1o5ig07
@r_lua
Dispel, Lua Runtime

The other day I created Dispel, a runtime for Lua that aims to be something like Bun does in JavaScript. This is a personal project to understand how a runtime it's implemented and I want to do my best but I want to know which things might be interesting to add, let me know here!

Also if you want to contribute in the future once I add more code to suggest features or help with fixes, I leave the repo here:

https://github.com/NotHurtGarci/dispel

https://redd.it/1o5lfej
@r_lua
Should I use Lua 5.4 or 5.5?

Hi everyone. I'm close to releasing an app that uses Lua heavily. I've decided not to go with 5.1 or LuaJIT, because I want my app's users to have full access to the latest libraries on LuaRocks, and the widest compatibility with the general Lua ecosystem. But I'm on the fence about using 5.4 or 5.5. On one hand, clearly 5.5 is the future, and eventually I'll have to update to it anyway. On the other hand, 5.5 is still in beta, and I'm not sure how many LuaRocks modules would be incompatible with it. Any feedback would be helpful and appreciated.

https://redd.it/1o5q167
@r_lua
What is the best way to learn Lua for someone with zero knowledge of programming and almost zero knowledge of math?

In the past 2 years I dipped my toe in several /r/mud games. Those are classic online, multiplayer, text-based games. MMORPGs emerged from MUDs.

Like most people I eventually had ideas of making my own MUD. But those games are far from trivial to make and maintain, especially for someone lacking any coding skills.

However, MUD clients allow for great customization. You can build entire interfaces that are both functional and aesthetically pleasing, making these games more approachable to many players. Especially beginners.

I noticed that the two major clients (Mushclient and Mudlet, which I prefer) can be fully noscripted in Lua.

I figured that is something I can do. It will still be fairly difficult for someone like me, but it's something I can do in one or two years. While making a full blown MUD can take five years to a decade for a beginner.

I'll choose a game and create omplete interface that is still text focused for it. Unlike other interfaces I woll give preference for keyboard input while making it more convenient. Ideally no one should be forced to take their hand away from the keyboard on a MUD. But that doesn't mean actually typing text from start to finish. That is my philosophy.

Perhaps by doing so I'll learn a thing or two about designing interfaces for MUDs, so I can generalize some principles and create interfaces for other games as well.

Anyway, I probably talked way more than I had to already ;)

I appreciate any suggestions.

https://redd.it/1o61xbl
@r_lua
Official Lua Book

Hello, did anyone here bought and read Programming in Lua by R. Lerusalimschy, one of the few official books released by lua team??? How long it take you to learn lua with that book and what review would you give?

https://redd.it/1o6da0p
@r_lua
i had to literally learn all ts just for rotation in a game 😭😭😭🙏🙏🙏
https://redd.it/1o73fk0
@r_lua
Programming in Lua, Fourth Edition, E-book Version
https://redd.it/1o7gv36
@r_lua
Having real trouble installing SciLua

Hi folks,

I use debian 12 and started learning lua with intent to use it in science. For this, I would like a library that could perform more advanced mathematical calculations. I found one that seems to be really fit for my intended use called SciLua, but no success in making it work. I already installed (or gave my best shot) at installing luajit and the other dependencies from scilua. Can someone help me out with the installation process? Is there another alternative for this library? Thanks

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