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

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

Powered by : @r_channels & @reddit2telegram
Download Telegram
HI im trying to learn lua and im 12

im trying to learn lua and im 12 so do someone knows a free app to learn lua ?
thx !

https://redd.it/1i4iut6
@r_lua
Terminal don't print anything of my lua code. Where did i go wrong?

Hi! I'm here again. I'm checking my learn on lua making a code. This code verify if talent (TLT) and efforce (EFT) are true, and then change the variables to make then have the same level, hp, and xp, even though they work by different ways. Buut, i guess something is wrong, since terminal don't print nothing. Someone can help me? Thanks for attention :)

HP = 0
XP = 0
LV = 0
EFT = false
TLT = true
TT = 0

if EFT == true then
HP = HP + 20
TTpoints = 10
XPproductionVR = 2
elseif TLT == true then
HP = HP + 5
TTpoints = 5
XPproductionVR = 8
elseif EFT == true and TLT == true then
HP = HP + 25
TTpoints = 10
XPproductionVR = 4
end

function TTproduction()
TT = TT + TTpoints
end
function XPproduction()
XP = TT * XPproductionVR
end

if TLT == true then
LevelUpVR1 = 20
LevelUpVR2 = 40
LevelUpVR3 = 60
elseif EFT == true then
LevelUpVR1 = 40
LevelUpVR2 = 80
LevelUpVR3 = 120
elseif TLT == true and EFT == true then
LevelUpVR1 = 40
LevelUpVR2 = 80
LevelUpVR3 = 120
end

if XP < LevelUpVR1 then
LV = 0
elseif XP >= LevelUpVR1 then
LV = 1
elseif XP >= LevelUpVR2 then
LV = 2
elseif XP == LevelUpVR3 then
LV = 3
end

while LV < 3 do
TTproduction()
XPproduction()
end

if LV == 0 then
HP = 5
elseif LV == 1 then
HP = 10
elseif LV == 2 then
HP = 20
elseif LV == 3 then
HP = 30
end

print(HP, XP, LV)

https://redd.it/1i4hiyk
@r_lua
What's the issue here?
https://redd.it/1i50v0y
@r_lua
Can someone please help me with my noscript?

I made a noscript for a game with chatgpt, it's basically 3 noscripts in one.

1-Caps Lock + Right Mouse Button + Left Mouse Button Rapid-Fire: This functionality is only activated when Caps Lock is on. It allows for rapid clicking when the right mouse button is held and the left mouse button is also held.

2-Right Mouse Button Toggles Right Shift: This noscript presses the Right Shift key when the right mouse button is pressed and releases it when the right mouse button is released. It operates independently of the other noscript's conditions.

3-Mouse Button Interactions: It handles mouse movements when the right mouse button is held, and the left mouse button is also held.

The issue is that when I press capslock so number 1 can work, the other two functions stop working. I need nr2 and 3 to always be active, but as soon as I turn on capslock for the rapid fire then only rapid fire works.

Here is the noscript but pasting it here messes up the formatting for some reason so here is also a screenshot how it looks like in the logitech ghub software: https://i.imgur.com/PiiaGfB.png

EnablePrimaryMouseButtonEvents(true)

function OnEvent(event, arg)
-- First Script: Caps Lock + Right Mouse Button + Left Mouse Button Rapid-Fire
if IsKeyLockOn("capslock") then -- Check if Caps Lock is enabled
if IsMouseButtonPressed(3) then -- If the right mouse button is held
repeat
if IsMouseButtonPressed(1) then -- If the left mouse button is held
repeat
PressMouseButton(1) -- Press left mouse button
Sleep(50) -- Speed of rapid-fire, adjust as needed
ReleaseMouseButton(1) -- Immediately release after pressing
until not IsMouseButtonPressed(1) -- Stop when left mouse button is released
end
until not IsMouseButtonPressed(3) -- Stop when the right mouse button is released
end
end

-- Second Script: Right Mouse Button toggles Right Shift (always active)
if event == "MOUSEBUTTONPRESSED" and arg == 2 then -- Right mouse button
PressKey("RSHIFT") -- Press Right Shift
return -- Exit here to avoid interference
elseif event == "MOUSEBUTTONRELEASED" and arg == 2 then
ReleaseKey("RSHIFT") -- Release Right Shift
return -- Exit here to avoid interference
end

-- Second Script: Mouse button interactions (always active)
if IsMouseButtonPressed(3) then
repeat
if IsMouseButtonPressed(1) then
repeat
MoveMouseRelative(0, 2)
Sleep(90)
until not IsMouseButtonPressed(1)
end
until not IsMouseButtonPressed(3)
end
end



Really hope someone can help me with this because chatgpt is messing it up.

https://redd.it/1i5zjpp
@r_lua
Logitech G hub noscript help

function OnEvent(event, arg)

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

print("Hello")

end

end

is something wrong with this code? I want it to print Hello when mouse 5 is pressed but nothing seems to happen in the console?

https://redd.it/1i60hor
@r_lua
How to write code to add a specific number to an existing value

This might be a very basic query, but I've gotta learn somehow. So let's say I have an address with a value of 1000, which in hex is 3E8. And I want to add 200 to it, which would be C8. Is it possible to write code that makes that happen? Something like :

BlobHP = 0x8086963

If ReadShort BlobGainsItem
add (C8) to BlobHP.

That probably hurt to read if you're actually good at this and I wouldn't actually write it like that, but I'm just trying to get the idea of what I mean across. Pls help if you know how.

https://redd.it/1i87v0k
@r_lua
question from complete beginner about for loops

https://preview.redd.it/lf9ecc7rutee1.png?width=1920&format=png&auto=webp&s=335377fa473beea58aca5a3ce37b0ed19a59d5e9

hi, i am a complete beginner in both lua and programming in general. i was just wondering if there is a way to make a variable using for loops (as you can see i'm repeating the same loop multiple times)

sorry if this has been asked before, i didn't really know what to search for on google for my question, thanks!

https://redd.it/1i8hanw
@r_lua
Matching markdown tables (regex)

I have a Lua noscript that parses MediaWiki markdown tables. It works great for "flat" tables where the elements in a row are all inline and separated with double pipes, but I'm having trouble making a separate noscript to deal with tables with each field on a different line such as this:

|-
| Game ABC
|{{untested}} <!-- xefu -->
|{{untested}} <!-- xefu2 -->
|{{untested}} <!-- xefu3 -->
|{{untested}} <!-- xefu5 -->
|{{untested}} <!-- xefu11 -->
|{{untested}} <!-- xefu6 -->
|{{playable}} <!-- xefu7 -->
|{{untested}} <!-- xefu7b -->
|{{untested}} <!-- xefu2019 -->
|{{untested}} <!-- xefu2021a -->
|{{untested}} <!-- xefu2021b -->
|{{untested}} <!-- xefu2021c -->
| Name Here
| Notes Here
|-
| Another Game
|{{menus}} <!-- xefu -->
|{{untested}} <!-- xefu2 -->
|{{menus}} <!-- xefu3 -->
|{{untested}} <!-- xefu5 -->
|{{untested}} <!-- xefu1
1 -->
|{{menus}} <!-- xefu6 -->
|{{menus}} <!-- xefu7 -->
|{{menus}} <!-- xefu7b -->
|{{untested}} <!-- xefu2019 -->
|{{untested}} <!-- xefu2021a -->
|{{untested}} <!-- xefu2021b -->
|{{untested}} <!-- xefu2021c -->
| Names Here
| Notes Here
|-

I'm interested in taking the info between two different |- as one entry.

I feel like I'm close, but having trouble since Lua doesn't seem to support lookahead or non-capture groups:

for row in wikitable:gmatch("|%-(.-)|%-") do

https://redd.it/1i9gn5f
@r_lua
Lua Powered Remote Garage Door Controller

This Lua-powered DIY DoorController project provides a web-based solution for controlling a garage door remotely. It includes a minimally invasive design with a magnetic reed switch for detecting door states and an NPN transistor for simulating button presses on a generic garage door remote. The software provides a web interface that can be added to mobile home screens for app-like functionality. The project also supports email garage door open/close state logging by configuring SMTP settings.

Project link: https://github.com/jjsch-dev/DoorController

https://redd.it/1i9ujlv
@r_lua
how to install luarocks on windows

I have done it before with the use of this installer, but I want to do it manually so I can customize stuff. The installer works, but it creates problems with my C++ installation.

Few requirements for the install:
Must be on a different hard drive with the packages also on that drive
Must not come with lua install as well. I want to use one I already have installed
Must like work or whatever

so how can i install it?


(also side note does it work with luau?)

https://redd.it/1i9tqxt
@r_lua
[SOLVED] "legacy sigalg disallowed or unsupported" error when emailing with LuaSocket

I have been emailing from Lua for a long with with the code on [this page](https://stackoverflow.com/questions/11070623/lua-send-mail-with-gmail-account/11070674). After updating Debian to Bullseye I got the error in the noscript, which was not at all helpful. After a lot of digging, it turned out that it is related to newer versions of OpenSSL.

The fix is to change the line:

`sock = ssl.wrap(sock, {mode='client', protocol='tlsv1'})`

to

sock = ssl.wrap(sock, {mode='client', protocol='tlsv1_2'})

I’m posting this for people to find later.

https://redd.it/1ia79k7
@r_lua
Script no recoil Logitech pour SCUM

Yo je cherche quelqu'un qui serait susceptible de m'aidé ..
a faire un noscript no recoil pour une armes ou deux sur scum en particulier l'ak47 avec p-223 et pour la rpk avec p-223 évidemment il faudrait que l'ont puissent changé les valeur en fonction de la force que l'ont a
Je sais que c'est peu être pas si simple mais j'espère trouvé quelqu'un qui puisse m'aidé vraiment .. !

https://redd.it/1iaexgh
@r_lua
Have fun, I hope someone can help with writing the macro. For game Rust ak47 new rec, in foto
https://redd.it/1iaw8f4
@r_lua
Lua noscript

Can someone help me learn how to make noscript that will do rapid fire in any fps games

https://redd.it/1iboynh
@r_lua
Lumorphix Processor IP Core - Scriptable with Lua

See the product page, documentation, beta release info and / or mailing list.

More to come... will keep you guys posted (if interested ?)

https://redd.it/1iboc2n
@r_lua
Does LUA seem... A little odd?

So I have some experience with this language but not a ton. I used it in a the context of a mod for satisfactory called ficsit networks. I created a factory that allowed you to request a certain number of a certain item and it would be automatically crafted. This was actually deliciously complicated. I had several coroutines acting to make this happen and the project was really fun but I never really finished it.

Recently I revisited it and I ran into what, in my opinion, is one of the downsides of lua. It has a minimalist aesthetic that makes it pretty easy to write. But old code that you haven't seen for a while looks like it was written by an alien. This is in spite of the copious comments I wrote.

It sort of stopped me dead in my tracks in a way that old python, c#, vba or java code never would have. And to be clear... I wrote this code.
I do this for a living... Not Lua... Obviously. But has anyone else experienced this more acutely with Lua than other languages? For me, the language is really hard to read because it's so minimal. Plus the fact that its somewhere between object oriented and not and the weirdness with the tables.... This is an odd language. I guess I need someone to tell me I'm not crazy.

https://redd.it/1ibxwnq
@r_lua
why does it say unexpected symbol when I run a noscript on Hammerspoon? it says [string "#SingleInstance Force..."]:1: unexpected symbol near '#'. anyway I know nothing about code lol help much appreciated.

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