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
RT Builder GUI design

I was practicing how to make GUIs in Lua and because I still suck at the hardcoding I opted to use a GUI Builder. I use LuaRT Studio IDE and RT Builder. They allow me to compile noscripts to exe.

https://preview.redd.it/rrd15hxl76df1.png?width=1920&format=png&auto=webp&s=936e62119da31502294097687dbdeab899f325d1

I have this issue. The GUI loads fine but quickly goes off screen like when you run a batch noscript and dont put "pause" in the batch code. I also get the errors down there..
What am i doing wrong here..

https://redd.it/1m14bka
@r_lua
did my first bit of LUA programming :)
https://redd.it/1m2ec20
@r_lua
The shortest Lua C function (0 bytes)

Hi everyone. I just stumbled upon this neat trick and wanted to share it. There is a somewhat useful C function that takes 0 bytes to implement! What it does is return all its own parameters in order (via multiple return).

To register it:

lua_pushcfunction(L, lua_gettop);
lua_setglobal(L, "pass");

To use it:

print(pass("hi", 123, true, "bye"))

Hope this helps someone!

https://redd.it/1m2e9ry
@r_lua
Is it possible to create an anti-recoil noscript for Fortnite?

Is it possible to create an anti-recoil noscript for Fortnite?.

Well, that's my question. I've spent several hours researching, creating, and practicing various noscripts, and I think they're either not working or are just "placebo" in use. I honestly don't notice it.

My mouse and in-game sensitivity is:

DPI: 850

X-Axis Sensitivity: 9.8%

Y-Axis Sensitivity: 9.8%

Aiming Sensitivity 76% and Crosshair Sensitivity 76%.


These are the following noscripts that I have tried and I have changed some things and it seems that it does not work.

EnablePrimaryMouseButtonEvents(true)



-- Patrón de recoil ajustado (solo hacia abajo, más agresivo)

local recoil_pattern = {

{0, 10}, {0, 10}, {0, 9}, {0, 9}, {0, 8}, {0, 8},

{0, 7}, {0, 6}, {0, 6}, {0, 5}, {0, 5}, {0, 4},

{0, 3}, {0, 3}, {0, 2}, {0, 2}, {0, 1}

}



function OnEvent(event, arg)

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

if IsMouseButtonPressed(3) then -- solo se activa si apuntas (click derecho)

for i = 1, #recoil_pattern do

if not IsMouseButtonPressed(1) then break end

MoveMouseRelative(recoil_pattern[i][1], recoil_pattern[i][2])

Sleep(16) -- 60 disparos por segundo aprox.

end

end

end

end


And here is noscript number 2:

EnablePrimaryMouseButtonEvents(true)



-- Solo recoil vertical, sin movimientos laterales

local recoil_pattern = {

{0, 10}, {0, 10}, {0, 9}, {0, 9}, {0, 8}, {0, 8},

{0, 7}, {0, 7}, {0, 6}, {0, 6}, {0, 5}, {0, 5},

{0, 4}, {0, 4}, {0, 3}, {0, 3}, {0, 2}

}



function OnEvent(event, arg)

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

if IsMouseButtonPressed(3) then -- Solo si apuntas

for i = 1, #recoil_pattern do

if not IsMouseButtonPressed(1) then break end

MoveMouseRelative(recoil_pattern[i][1], recoil_pattern[i][2])

Sleep(16)

end

end

end

end

Thanks for making it to the end of this post. Could someone help me fix my noscripts? Or give me some tips on how to make it work? Thank you so much, everyone!

https://redd.it/1m2mupt
@r_lua
I want to learn lua, need help

I want to learn lua from scratch, but nothing is installed and I don’t know anything about this language. Can someone send me stuff for learning lua please? (Videos, programming environment, docs,…)

https://redd.it/1m3qnz2
@r_lua
Updates on Caelum

A week ago a made a post on this reddit in regards of a library that I am creating, Caelum, after that post i added more features that made me realize that this project is getting bigger and bigger, when in reality it was meant to be only a small library to help integrate lua in my engine.

At this point I am asking myself, is anyone really interested in a library such as Caelum-lua?

With this question in mind I wanted to make this new post in this reddit to understand more the lua vision and the lua-programmers as a programmar myself coming from a totally different type of programming "habitat".

Let me know your real opinion on the library, where you think it should go, maybe features that are too much or not really lua-centrinc that should be removed, features that you would like to see in a library like this, and if you like you can also bring your ideas directly to the github repo, as I said in the previous post, I would like to expand this library with a community driven vision and ideas.

Feel free to ask any question!

Thank you for your attention, and sorry if it is not really a topic on lua but more on the development path of a library

https://redd.it/1m3x9tr
@r_lua
Which tools do you use in your Lua projects?

I'm new to Lua and have found StyLua for formatting and selene for linting. Are these the best options? Are there any other tools I should be using?

https://redd.it/1m456yx
@r_lua
is there an easy way to run a LUA mouse macro?

Previously used logitech though stopped working

https://redd.it/1m4m2am
@r_lua
_G and _ENV

Hello. I am reading the chapter about environments from *Programming in Lua, 4th edition*, and also did online searching regarding `_G` and `_ENV`. Here are my observations and experimenting for record. Feel free to comment if you have something to add or correct.

* The `_ENV` is a local variable for the compiled chunk but can simulate a *global* environment by the compiler's mechanism of prepending all free names with `_ENV.` . Creating and accessing a global variable e.g. `a = 5 print(a)` is equivalent to `_ENV.a = 5 print(_ENV.a)`.
* The `_ENV` is initialized to be the same as `_G`, because `_G == _ENV -- true` (having the same memory address).
* `_ENV` contains a field of `_G`, and `_G` contains a field of `_G` as well.
* A global variable assignment such as `a = 5` puts a key of "a" and value of 5 in `_ENV` and `_G` simultaneously because they are still the same table. Evidenced as below:

​

print(_ENV) -- table: 0x6000017d8040
print(_G) -- table: 0x6000017d8040
a = 5
print(_ENV.a) -- 5
print(_G.a) -- 5
print(_ENV) -- table: 0x6000017d8040
print(_G) -- table: 0x6000017d8040

The result is the same if `a = 5` is replaced by `_ENV = 5` or `_G = 5`.

* However, if `_ENV` is assigned a new table, the memory addresses of `_G` and `_ENV` will be different, but the rule that the *global* environment is `_ENV` still applies.
* Example of overriding the \_ENV:

​

print(_ENV) -- table: 0x600001844200
print(_G) -- table: 0x600001844200
_ENV = {_G = _G, print = _ENV.print} -- can also be print = print or _G.print
print(_ENV) -- table: 0x600001840140 -- different from before
print(_G) -- table: 0x600001844200
a = 5
print(a) -- 5
print(_ENV.a) -- 5
print(_G.a) -- nil

In this case, `_G` will be prepended as `_ENV._G`, but since it was never added the field of "a", `_G.a` is `nil`.

https://redd.it/1m5766o
@r_lua
Need beta testers for HRAM (hand-rolled assembly machine)

Hi everyone. I'm making an app called HRAM (hand-rolled assembly machine), and I plan to release it this week. But I need some beta testers first. Please send me an email at admin@90s.dev if you're interested. Your feedback will be helpful enough that I'll give you a free license. The app is only for Windows (10 or 11).

The app is programmable via Lua and has an assembly library built in, so you can create and run assembly functions at runtime. It has a 320x180 pixel screen that you can manipulate to help you practice assembly. The point of the app is to help learn low level concepts, in the fun environment of making a retro style game. I'm also in the process of adding threading/mutexes/etc also, but that may have to wait post release.

Current manual is at https://hram.dev/docs.txt

https://redd.it/1m5jfw0
@r_lua
Can someone make a code that makes my gun recoil in the opposite direction to where I'm pointing please?

Excuse me for asking this here, but I'm trying to make a Terraria weapon in Gmod, and as a secondary attack, it makes a noise like the Tau-Cannon and sends me far back. If someone can do it or give me instructions on how to do it, I would appreciate it. Thanks in advance.

I'm not uploading the code because it won't let me for some reason

https://redd.it/1m5qjo9
@r_lua
FiveM Lua Dev

Hi there!

I'm currently looking to take on some Fiverr gigs at a very affordable rate. I have over 2 years of experience in Lua development and a year of experience as a full-stack developer.

Whether you need a simple noscript or a large-scale project, I can deliver clean, documented, reliable code for just a few bucks. I'm building up my Fiverr portfolio and would love to help bring your ideas to life!

Feel free to reach out - let’s work together!

https://redd.it/1m5ud8e
@r_lua
Beginner code question on nested tables

I am trying to construct and print a nested table In this simple example:

#!/usr/bin/env lua
company = {director="boss",
{address="home",
{zipcode ="12345"}
}
}

print(company.director) --> boss
print(company.director.address) --> nil - was expecting 'home'
print(company.director.address.zipcode)

print(company"director") --> boss
print(company"director""address") --> nil - was expecting 'home'
print(company"director""address""zipcode")

It prints nil where I was expecting it to print 'home'.

What am I doing wrong?



https://redd.it/1m61yq3
@r_lua
Sol2 and Modules

What are your thoughts on using cpp and sol2 library to create Modules to use in lua noscripts?
Do you prefer a Module written in c/cpp with the pure lua api, or Is It ok to use sol2?

https://redd.it/1m677cb
@r_lua
Luans - a Lua Learning App inspired by Koans (beta)

Hey everyone,

We’ve created a small web app to help people get started with Lua: [**play.tenum.app**](https://play.tenum.app)
It’s inspired by Kotlin Koans — we’re calling it **Luans**.

Each exercise is structured as a failing unit test, and your goal is to make it pass. The idea is to learn Lua through hands-on practice, one small step at a time.

Right now, the app is super basic and only contains a few lessons. We're testing right now and would love to hear from this community:

* Is this format helpful for learning Lua?
* What kinds of exercises or topics would you want to see?
* Are there other Lua learning platforms/tools you’ve used or recommend?

We’re considering investing more time into it, so your feedback would mean a lot.

Thanks in advance

https://redd.it/1m6bykq
@r_lua
Working on a Wireshark parser, why does TreeItem:add_le() not reverse strings too?

My first instinct would be to post to r/wireshark, but last time I had a similar question I was directed here. Apologies if that’s incorrect.

[Link to line in docs](https://www.wireshark.org/docs/wsdg_html_chunked/lua_module_Tree.html)

Trying to fetch a little endian string, but it’s reversed because apparently the little endian add function only works on numbers? This feels really wrong, I can’t imagine why it works like this. Let me know if a more elegant way to display this is known.

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