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
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
How do i split my lua?

So as i want to split my lua, regardless of how necessary it is to split it, i want to split it to learn how to do this, my problem is that my lua consists of a menu entirely self coded due to the api im working in and due to this:

\- I want to split the lua into multiple pieces i can use the same way

My problem:

\- Every single part of the lua is linked to the menu

For example:

local current_time = Controls["TimeDisplay"] and string.format("Time: %s ", os.date("%H:%M:%S")) or ""

How do i split this part of the code into another lua, the controls is a local and TimeDisplay is a variable inside a checkbox structured like this:
`Checkbox("Show Time", "TimeDisplay", posX, posY)`



https://redd.it/1hcv8a8
@r_lua
Trying to add a HTTP POST to existing code. HTTP not found. Socket.lua not found

First off I have never worked with LUA before. I am modifying an existing application. The game is IKEMEN GO. IKEMEN GO . All I have to do is add in a HTTP POST. That is it. I found the spot where I need to add the code. I added the code and the problems started. From my understanding LUA doesn't come with anything for HTTP and has to be added / installed / complied (not sure what to call it).

I am on Windows 10 using VSCode with LUA extension.

I reached out to the IKEMEN group and was told it was beyond scope but any library for LUA 5.1 will work. I assume there is a HTTP library???? I did not install anything dealing with LUA. The game comes with a CMD file. I click the file everything works. There are some noscripts to run beforehand but my understanding those are for GO and not LUA.

I downloaded LUA 5.1 and installed it (I think so, I have source code and binaries). After searching around I found some HTTP.lua files on the net. They didn't seem to work with what I have. I then found I could run luarocks install HTTP or maybe it was luahttp, I can't remember. That didn't work. I don't remember the errors but I gave up on it a few days ago. I then found luarocks install luasocket. Here are the errors I got.

https://preview.redd.it/7td2wgg49h6e1.png?width=1906&format=png&auto=webp&s=59bf14abfc8d6eae2b665b3fbb409ca12b91f547

I looked up and it looks like msys64 isn't installed correctly. I uninstalled it and installed it again and got the same errors. I am out of ideas. This should have been a few simple lines of code and is turning into a multiday nightmare.

In my Lua 5.1 folder I have a socket folder and http.lua and a few other files. Although socket.lua requires socket.core which I do not have. Thanks for any help.

https://redd.it/1hcun7d
@r_lua
Someone teach me this

Alright, so I’ve been coding for this game called Ark: Survival Evolved using Beacon. It’s not really heavy coding or anything, but I’ve been able to make a decent amount of money from it. The thing is, Ark is dying pretty fast, and I feel like there are better opportunities out there.

I’ve done some research and talked to a few people, and they all suggested switching over to Roblox. Apparently, it’s huge right now. Roblox uses Roblox Studio, and the coding language is Lua.

So here I am, trying to figure out how to get started or even how to get better at this. If anyone can help point me in the right direction, that’d be awesome.

https://redd.it/1hcykr4
@r_lua
how do i make a way for this tile to move smoothly, my map uses a tile system

function love.draw()
love.graphics.setColor(255, 255, 255)
drawMap()
drawUi()
love.graphics.draw(player.me, player.fakex, player.fakey)
love.graphics.draw(text, 32, 32)
if(mouse.x<map.width and mouse.y<map.height) then
love.graphics.setColor(255, 255, 255, .5)
love.graphics.rectangle("fill", mouse.x32, mouse.y32, 32, 32)
end
end



function test (x, y, xd, yd)
currentTile = mapTile(x+xd,y+yd, "get") --get map tile x+x distance y+y distance
text:set(currentTile) --idk if there is a debugger for mac i just use text
if currentTile == 0 then --air
return true
elseif currentTile == 2 then --pushable
if test(x+xd, y+yd, xd, yd) == true then
map.mapxyidx(x+xd, y+yd) = 0 --pushable removed
map.mapxyidx(x+xd*2, y+yd*2) = 2 --added back in the direction player is moving
return true
else
return false
end
elseif currentTile == 1 then
return false --wall
end

https://redd.it/1hddg7j
@r_lua
How do I change a variable in another file?

Sorry if this seems a bit simple, but I've been looking though a bunch of different sites and videos and couldn't find an answer.

I'm trying to edit a variable in a noscript from within another. I'm able to bring in the "corruption" noscript as an object utilising "noscript", but I can't edit any of the values inside "corruption", at least not from "noscript". Not sure if there's some specific line of code I'm missing or if I'm doing it incorrectly.

corruption.lua

--Edit these values
corrupted = 0 --How much corruption the player starts with (Default = 0)
healthDrain = 0.02 --How much health the opponent takes with each note (Default = 0.02)
--------------------------------------------------------------------------------------------------
local corruption = require("mods/Corruption Victims/modules/corruption") --This brings in the noscript successfully

corruption.healthDrain = 0.1 --This doesn't work

noscript.lua

https://redd.it/1hebaki
@r_lua
no recoil noscript idea for r6 siege

Hi. Do you think it would be possible to create a Luan noscript to control recoil by implementing a pixel decoder i.e. for example if the screen is moving down to the right at the same time? Would the Opposes noscript to keep the vision straight would it be possible in your opinion? and what program should I use? ps I'm new to lua and trying to understand something

https://redd.it/1heuw60
@r_lua
Cool lay code sharing

So I’ve recently been working a lot on a set of roblox movement noscripts to handle things like swimming and sprinting.

While I was taking a break I was thinking what other cool lua code people are working on.

Whether you just want to talk about it or actually share it is up to you!

https://redd.it/1hf0c65
@r_lua
Is there a standard package manager for lua?

Hello, I come from a coding background, but am new to lua(only ever wrote noscripts for aseprite).

I'm curious is there a standard package manager for lua?
ala bundler for ruby or mix for elixir.

Some context, I found a pretty cool looking game engine(love) and figured I'd make something to get a feel for it. The getting started guide suggests installing it system wide which seems bad and some quick googling for a package manager produced multiple results, so I wasn't sure where to start.

Figured it might be a dumb question with an obvious answer so worth asking before I research it myself.

Thank you everyone for the help.

https://redd.it/1hfmptw
@r_lua
Code Error - Need Help!

Received an error on line 14 code in Trading Station, which uses Lua. The error states "Colon (;) expected here." Here is the code through line 14. Does any one have any thoughts?


\-- ICT Breaker Block Algorithm for Trading Station

\-- Time Windows: 9:20-9:40 AM, 10:20-10:40 AM, 10:50-11:10 AM EST



\-- Parameters

local lookback = 20 -- Lookback period for swing high/low detection

local riskRewardRatio = 2 -- Risk-reward ratio for take profit

local timeWindows = {

{start = "09:20", end = "09:40"},

{start = "10:20", end = "10:40"},

{start = "10:50", end = "11:10"}

}



\-- Variables

local swingHighs = {}

local swingLows = {}

local breakerBlock = nil

local entryPrice = nil

local stopLoss = nil

local takeProfit = nil



\-- Helper function to check if the current time is within the allowed time windows

function isWithinTimeWindow(currentTime)

for _, window in ipairs(timeWindows) do

if currentTime >= window.start and currentTime <= window.end then

return true

end

end

return false

end



\-- Initialize the strategy

function Init()

strategy:name("ICT Breaker Block Strategy for NQ")

strategy:denoscription("Executes trades based on ICT Breaker Block concept during specific time windows.")

strategy.parameters:addInteger("Lookback", "Lookback period for swing high/low detection", "", lookback)

strategy.parameters:addDouble("RiskRewardRatio", "Risk-reward ratio for take profit", "", riskRewardRatio)

end

https://redd.it/1hg0d6f
@r_lua
Looking for a Lua Fullstack Developer - Serverless Web Apps for a German Startup

Hey everyone, i've posted here a couple of times about the platform that the startup i work for is developing.

It's a german startup called Tenum and we're looking for a Lua fullstack developer (preferably as a freelancer) to help us build serverless web applications on our platform. The platform is still under development, but already a great experience to get things done fast.

If you have solid experience with Lua and web development and would like to work with a new technology on various customer projects, I'd love to hear from you.

This would be the ideal process:

1. After you've contacted me here on Reddit or via email, we'll set up a quick call with the founder.
2. Then we'll show you the platform and discuss the details.
3. If there's a fit, we'll start working together.

We'd prefer someone whose time zone is well aligned with ours (CET).

If you're interested, dm me or email me at hello@tenum.ai with a short note about yourself and your experience.

Thanks a lot!

https://redd.it/1hgenoi
@r_lua
Logitech g hub Lia noscripts not working on steam but work on Ubisoft. Why is that?

Can somone help me with my lua noscripts they will not work when I launch the game through steam?

https://redd.it/1hgjsn2
@r_lua
Beginning

I really want to start Lua as a hobby to make games but have absolutely no idea on where/how to start. Anyone please help me.

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