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
FiveM Lua Help

Hello,

So basically purchased a FiveM noscript for esx and went to ask the creator for help on making the reward black money or dirty money instead of cash and he basically told me to screwoff. Kind of ignorant for such a small request BUT I do need some help on this code so that I am able to have it give players black money instead of clean money. Thanks in advance and for your time.

The code is as follows:

RegisterServerEvent('sh-boomerphone:sellItem', function(itemName, count, price)

local src = source

if framework == 'esx' then

local xPlayer = ESX.GetPlayerFromId(src);

if not xPlayer then return false end

if xPlayer.getInventoryItem(itemName)?.count >= count then

xPlayer.removeInventoryItem(itemName, count)

xPlayer.addMoney(price * count)

end



https://redd.it/1h5y70l
@r_lua
How to learn to make a Lanczos/Magic Kernel GIF downscaler in Lua?

I already wrote a decoder that gets all the frames’ pixel color data

https://redd.it/1h61hqz
@r_lua
Why do people still use lua?

Luau outclasses any form of lua out currently with much nicer source code and overall better features + native makes it as fast as gcc c++ so why do people use this irrelevant language?

https://redd.it/1h6zrmf
@r_lua
where do you learn lua for noscripting in games like roblox?

as the noscript says i wanna learn lua but idk how i should go about it or where i would learn it from

https://redd.it/1h7lt41
@r_lua
I am a roblox client or local sided developer and I want to make a client sided path finding service for a sword fighting ai that already has the moving part and attacking now I just wanted to add path finding so it's better any help?

So I've been working on a sword fighting bot on the client and I need some help read the noscript to see what I need help with.

https://redd.it/1h7r12l
@r_lua
Lua Help

I dont know how to use lua and i want to learn, but there are no websites to learn lua

https://redd.it/1h7vbr7
@r_lua
Key swapping Lua Scripts for 9 keys (PRTSC - PGDN)

Key swapping Lua Scripts for 9 keys (PRTSC - PGDN) to be NumPad keys (1 - 9) instead.

don't think I ever use these keys unless for something very specific but it can change back with another profile.

Is there anyone who can write this seeing as I have no clue to write noscripts at all. Thanks in advance.

https://redd.it/1h8d9dg
@r_lua
I can't get this example code from Logitech G HUB Lua API to run

function OnEvent(event, arg)
if (event == "M_PRESSED" and arg == 1 ) then
--M1 has been pressed
end
end

In the console it says loaded


https://redd.it/1h8jzsd
@r_lua
I'm new at noscripting | need help to fix

My Goal: When the Player touches the Part, then BrickColor should change into Red, but in the output is that: BrickColor is not a valid member of Model "Workspace.gy23" - Server - Script:5


and here is the code :

local GS = noscript.Parent



function Playerhit(Hit)

if Hit.Parent:FindFirstChild("Humanoid") then

Hit.Parent.BrickColor = "Red"

end

end



GS.Touched:Connect(Playerhit)



Pls help me to fix this code


https://redd.it/1h8rwzw
@r_lua
Is there a way to use a function this way?

My case is very specific:

The api i use doesnt have a native checkbox, slider etc(gui) so i made one on my own, i ran out of locals to use

Checkbox("Name", "Something", x, y)

Is there any way to something like

if Controls"Something" then
otherlua.function
end


Seeing as my noscript on the other lua runs all the time? Is there any way to like call the entire noscript?

https://redd.it/1h926cb
@r_lua
Learn Lua with EdgeTX api environment

Hi, I want to practice Lua writing EdgeTX noscripts for FPV drone telemetry. I have found a pretty decent documentation for edge tx and Lua . In order to acomplish my task I need to establish a communication with flight controller on my drone wich has betaflight firmware (see MSP communication) . There is a nice lua noscript for communication with betaflight (see here) but for me it is hard to understand how it comminicates with betaflight on byte level. Do you have any small easy to understand examples to dive into it ? Thank you

https://redd.it/1h94jfn
@r_lua
Is there a good way of generating 2D graphics without a game engine?

I want to create something like desmos but only for simple functions (ax\^2 + bx + c). I have created the function that finds the y values for many given x values so the function can be drawn. This is where I have encountered a problem, I don’t know how to generate such graphics. I have tried searching for something but all I found was game engine tutorials that incorporate Lua and not methods of displaying graphics without an engine, as for my application, I find it unnecessary.

https://redd.it/1h9omsv
@r_lua
Getting error info from custom error handler and xpcall

I’m using xpcall and want to know how to get error info from a custom error handler function.

Function error_handler()
Print(debug.traceback)
End


If I use

err, ok = xpcall(func, error_handler)

I lose the error message itself but I get the trace.

If I use

err, ok = xpcall(func, debug.traceback)

I get the error message and the trace when I print err.

https://redd.it/1haee9w
@r_lua
Botting in lua

Hello, I was wondering can I create a bot for a game in lua?
By "bot" I mean reading screen, moving mouse and simulating keyboard and mouse input.
I already tried doing this in python, but after spending an entire day trying to install and then debug python libraries I gave up.
I'm open on learning new things.

https://redd.it/1hb82s1
@r_lua
FiveM programming

I’m searching about this topic for weeks, and I still didn’t find an answer. I just have some questions about it.

1. What are the best resources to learn FiveM Lua?
2. What’s the best place to learn FiveM Lua?
3. How can I learn FiveM Lua?
4. Do I need courses?
5. How can I learn to solve FiveM errors?

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