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
(Japanese Article, Advent Calendar, Overview) - [luarrow] Using pipe operators and Haskell-like function composition operators in Lua [Lua]
https://redd.it/1paz4e4
@r_lua
Help with a logitech ghub noscript

I want to make a noscript that have mouse movement when I click mouse button 4 then has extra movement when I click it while holding rmb. I don't really know how to code so I came here for help. The mouse button 4 works just fine but the right mouse button click doesn't change the movement at all. I was wondering if anyone who knew how to code for logitech ghub could help fix this code.


MoveAmount = -628

ExtraMoveAmount = -12000

function OnEvent(event, arg)

if event == "PROFILE_ACTIVATED" then

EnablePrimaryMouseButtonEvents(true)

elseif event == "PROFILE_DEACTIVATED" then

ReleaseMouseButton(4)

end

if event == "MOUSE_BUTTON_PRESSED" and arg == 4 then

local amount = MoveAmount

if IsMouseButtonPressed(2) then

amount = ExtraMoveAmount

end

for i = 1, 10 do

MoveMouseRelative(amount, 0)

Sleep(5)

end

end

end

https://redd.it/1pbrh3u
@r_lua
LuajitOS - A Nearly Full Lua Operating System

Hi, I have made an operating system called LuajitOS, most of it is written in lua so I thought it might be of interest to this subreddit.

It has its own desktop environment and can be completely customized, for example the task bar and the backgrounds are just normal programs that can be replaced. The whole app ecosystem will be in lua, this allows you to remix apps written by other people. Each application runs in it's own sandbox and can request permissions to call OS functions through either an embedded manifest as a comment at the top of the file or as a manifest.lua in the packaged application.

It comes with:
- text editor
- paint program
- shell
- browser (only local html files ATM)
- a calculator
- cryptography tool
- application manager

I'm aware someone else has made something similar before but i this is totally separate.

It's available as an ISO or as source code at luajitos.com and there is also a demo video for those who don't want to download

It's currently has no license because I'm still deciding which one.

https://redd.it/1pc191y
@r_lua
LuaJIT Array optmization

GitHub Copilot told me that defining an array as:

t = {
[1] = val1,
[2] = val2, ...
}

will signal Lua / LuaJIT to understand it as a hash table only, due to use of square brackets, even if lua array integrity were respected. It said that to allow array optimization, one must define array implicitly t = {val1, val2, ...}

But Copilot also admitted that defining an empty table first and looping values into it like: ... do t1[i] = t2[i] end OR: do t1[#t1 + 1] = v end would make it realize and optimize as a real array under the hood, even though it also uses square bracket assignments (but on an already created table, which is the only difference to above example, where values are added into a not yet created table).

However, i then asked the same question Gemini, and it said the Copilot was wrong. In the first example of explicit creation Lua / LuaJIT will correctly identify it as an array and optimize for it. It only cares whether lua array integrity is respected.


Who is right?

https://redd.it/1pc62yx
@r_lua
IDE Engine

Hey everyone, I’m trying to solve a problem I’ve run into on both Android and the web, and I’m wondering if others have noticed it too.

There are a few Lua IDEs out there for Android and browser use (JDoodle, etc.), but none of the ones I’ve tried actually support things like io.read() input or, more importantly, building any kind of UI. It makes it tough if you want to learn Lua on mobile or bounce between your PC and phone while working on an app or game.

So I’m building an app to fix some of that.

It basically mixes a regular embedded Lua environment with the LÖVE (Love2D) engine, so you can actually build and run games or apps inside the app itself on mobile. Anyone who’s used Love2D knows how flexible it is, and having that power on Android has been missing for way too long.

I’m still early in development, but I’d really love feedback or feature ideas from the community—things you’d want in a tool like this, pain points you’ve run into, etc.

Once it’s ready, I’m planning to release it as open-source so people can contribute and trust what’s under the hood.

Thanks for reading! Happy to answer any questions.

https://redd.it/1pcgqlm
@r_lua
Is this program a good place to start?

Now i know everyone says yes it is but is this simplicity something people tend to rely on? or could i learn another language (say another fairly simple one like python) it wont be so much a bother. i know this may be a dumb question but i want to learn more than one type of code so i can be versatile and helpful.

https://redd.it/1pdm6qe
@r_lua
I wrote whole hyprland custom noscripts in Lua instead of the standard Bash.
https://redd.it/1petpp6
@r_lua
Built my debut game with Lua for the Playdate and the experience was awesome!
https://redd.it/1pf1f7v
@r_lua
please ban roblox studio posts

Right off the bat it is not because they are bad or have bad intentions. But there are many other places for these things with more knowledgeable communities such as r/robloxgamedev and r/ROBLOXstudio.

95% of help posts for these are just "i know nothing, where can i learn" (which all have same answer and don't need a post. 5 seconds of google search can solve this.) or "i know nothing, looking for devs to teach me and help me make my game" (no one wants to help someone with 0 experience make a game/dedicate their time when there are thousands of pre existing online guides)

So because:
1. There are better places for roblox related posts
2. Most posts are made by noobs and have same answers
3. They make it a bit hard to find non-roblox posts (not as much in this sub but still)
4. NOT because the OP has bad intentions

Roblox related posts should be banned (unless they have a good reason to be in specifically this sub, such as conparing to other lua variations)

https://redd.it/1pf3tkt
@r_lua
Anyone know how to code with Lua on roblox and willing to teach me or help me make a game



https://redd.it/1pf1ey6
@r_lua
Mini not-so noscripting language in Lua

Hi! I've been working on a project for the past few days. It's kinda like a noscripting language but it's really not. It feels like more of a layer over Lua, but I'm very happy about it. It makes me feel like learning how to code wasn't a useless waste of time.

Github: https://github.com/oberondart/NovaScript

To use it, download nova.lua and require it into your program.

-- noscript in novanoscript (ik its a stupid name, but I CANT THINK OF ANYTHING >:) )

local nova = require("nova")
nova.let("mystring", "hello, world!")
nova.out("my
string")

nova.let("mynumber", 1)
nova.let("this
number", 2)
nova.let("happynumber", 3)

nova.out("my
number")
nova.out("thisnumber")
nova.out("happy
number")

nova.array("myarray", {1, 2, 3, 4, 5})
nova.out("my
array")
nova.out("goodbye, world!")

https://redd.it/1pf6f5l
@r_lua
LF a lua project I can help with

I just have nothing of my own and no inspiration for something new to work on. so I thought I would try to find a project I can help with.

no roblox or nonstandard lua, no luajit either

DM open

https://redd.it/1pf63gn
@r_lua
Working on a Lua TUI Compositor.

I wrote my own simple little "Window Engine" as I like to call it, as my four brain cells can't think of a better name.

Basically all it does is draw boxes, circles, and windows in a terminal window without the fuss of manually defining the size and all the writable space.

The source code for the "Window Engine" can be found here (do excuse the poor repository, my first time doing a serious project...)

Screenshot of this in action, in the included starfield demo.



https://redd.it/1pgoat5
@r_lua
Full-stack event-sourced demo app written entirely in Lua

Hello all,

I have created a demo called Todoodle that demonstrates a full-stack application written entirely in Lua using TENUM’s artifact-based approach. It’s a todo app built with CQRS + event sourcing for the domain logic and a reactive UI layer (LuAct) for the frontend.

The project includes:

* Entities with commands/events/queries (todo.e.lua, todoList.e.lua)
* UI components written in Lua (CreateTodo.uie.lua, TodoItem.uie.lua, etc.)
* Spec files for testing the domain logic
* A development flow with live preview and test watcher

The goal is to explore what a full-stack workflow in pure Lua can look like, without build noscripts or infrastructure code. I’d be very interested in feedback from the community on the workflow, design choices, and expected tooling.

We also plan to provide an open-source version of the framework, and this demo helps validate the approach.

If you’d like to try it:

checkout: [https://github.com/TENUM-Dev/todoodle](https://github.com/TENUM-Dev/todoodle)

npm install -g u/tenum_dev/tdm-cli

tdm test --watch 

tdm preview




or simply watch the demo video:

[https://www.youtube.com/watch?v=Acxfu-IhqKs](https://www.youtube.com/watch?v=Acxfu-IhqKs)

Thanks, and I’d appreciate any thoughts or critique.

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