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

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

Powered by : @r_channels & @reddit2telegram
Download Telegram
Sony Inzone interfering with Lua noscript

I’m not quite sure if this is the right place for this but I use lua noscripts on my Logitech mouse for video games, and today I bought some Sony Inzone earbuds. It seems to make the values for the recoil higher out of nowhere but it’s only while the usb-c dongle is plugged in. It doesn’t change the actual values in the noscript but it responds about 2-3x stronger. It seems unrelated to the control center app from Sony but is affected by the dongle. Does anyone have a fix for this or know why this is happening?

https://redd.it/1jnstfp
@r_lua
A good learning resource for lua and programming in general?

What are your recommendations?

https://redd.it/1jntn67
@r_lua
How to interpret bit.lshift 2 and bit.lshift 2ULL?

Here is my snippet code as follows:d

#!/usr/bin/env resty

local ffi = require("ffi")
local bit = require "bit"

local lshift = bit.lshift

local function printx(x)
print("0x"..bit.tohex(x))
end

local lshiftuint64
do
local ffi
uint = ffi.new("uint64t")

lshift
uint64 = function(v, offset)
ffiuint = v
return lshift(ffi
uint, offset)
end
end

print("--- ffiuint = v ---")
printx(lshift
uint64(2, 61))
printx(lshiftuint64(2ULL, 61))
printx(lshift
uint64(0x2ULL, 61))

local lshiftuint64new
do
lshiftuint64new = function(v, offset)
local ffiuint = ffi.new("uint64t", v)
return lshift(ffiuint, offset)
end
end

print("--- ffi
uint = ffi.new ---")
printx(lshiftuint64new(2, 61))
printx(lshiftuint64new(2ULL, 61))
printx(lshiftuint64new(0x2ULL, 61))


The output on my macOS is:

--- ffiuint = v ---
0x40000000
0x4000000000000000
0x4000000000000000
--- ffi
uint = ffi.new ---
0x4000000000000000
0x4000000000000000
0x4000000000000000

The output of printx(lshift_uint64(2, 61)) seems just 32-bit long?

https://redd.it/1jntw7g
@r_lua
ide's or libraries for young learners?

i have a pre-teen sibling who wants to learn coding, he has tried scratch so he has somewhat of an experience to coding, he has created some games with it and he did it well! he told me he wanted to try 'real' code, so this is where this reddit post steps in.

he loves to try new things, so he doesn't mind doing pure code!

https://redd.it/1jo0p5s
@r_lua
Using continuation functions as normal functions possible?

I have often the case where I want to loop and within that loop call a lua function or have to yield, but yieldable with continuation.
For that I have to provide a continuation function which only functions as trampoline to call the normal function again.

int foo(luaState*);
int foo
continue(luaState* L, int, luaKContext) {
foo(L);
}
int foo(luaState* L) {
while (true) {
/* do things */
lua
yield(L, 0, NULL, &foocontinue);
}
}
int main() {
// ...
lua
pushcfunction(L, &foo);
// ...
}

Because I have to persist the runtime, I'm using Eris, I now also have to add the continuation function to the persistency table.

I would love to remove that boilerplate by simply doing something like this:

int foo(luaState* L, int, luaKContext) {
while (true) {
/ do things /
luayield(L, 0, NULL, &foo);
}
}
int main() {
// ...
lua
pushcfunction(L, &foo);
// ...
}

Using reinterpret cast that seems to work just fine but idk if that is really stable and doesnt cause undefined behaviour.
So, is this allowed or not?

https://redd.it/1jo284c
@r_lua
Good resources on Lua that also teach programming fundamentals?

I'd like to believe I know Lua well enough, having used it a lot for game modding. However there's a lot of people who come to our community trying to make mods with zero knowledge of programming, and trying to help those people gets frustrating for everyone involved.

What resources are there that teach Lua while also explaining basic concepts (variables, conditionals, loops, etc.)? First few tutorials I could find seem to be made for people who already know programming and just need a crash course on specifics of the language...

https://redd.it/1jo4ihc
@r_lua
Termfx make fails with error lua.h: No such file or directory

What it says on the tincan. Attempting to build Termfx without Luarocks (because luarocks has caused nothing but pain and suffering for me) and I'm not able to make it successfully as it doesn't seem to be able to find the C headers.

I think this boils down to me not specifying where the lua.h file is, but I don't know how I can do that. Thanks for any help

https://redd.it/1jo7trj
@r_lua
Accidently deleted Ghub lua noscript command and now cant remember.

There was a lua file located on my computer on D: , a noscript was running it without copying everything to GHUB,it was someting like D: ..... Test.lua, i accidently deleted it and cant remember now would you guys help me?

https://redd.it/1jp2z0m
@r_lua
Obfuscated lua file

Hey. I have a lua file that is in my fivem server, I need to edit a few things in the file
Is there a way to deobfuscate the file through my server key?
I bought the file legally

https://redd.it/1jp8yq8
@r_lua
What special Lua tutorial would be useful?

Hello I make YouTube tutorials. I made a general “Learn Lua” tutorial but I would like to make specific tutorials. I was thinking of teach concepts like strings (and its functions) and metatables. Are there any tutorials that would be useful please let me know?

https://redd.it/1jq4kyd
@r_lua
RE Clone?

So I would like to make what is essentially a classic RE Clone, survival horror genre, tank controls, fixed camera angles, pre rendered backgrounds, etc. Would Lua be a good platform for that?

https://redd.it/1jquivi
@r_lua
funcional microphone help

Hi, I need help making or finding a code to make a functional microphone for voice chat in Roblox. If anyone has a noscript that might work, please share it with me and if you can, explain to me how to use it, hehe (sorry if I asked for too much).

https://redd.it/1jqvlcq
@r_lua
What’s the best way to learn lua?

I’m brand new to lua and I’ve wanted to learn for years now specifically to noscript roblox games but also just to use for my own fun. Which was making me want to ask what applications, websites, videos are useful that could be recommended for me to learn?

https://redd.it/1jqvcl5
@r_lua
Help me with noscript for GHub.

Hello, im just trying to make noscript that clicks certain points on the screen. Problem is, running noscript doesn't use right mouse button or doesnt use it at all. Also i need to run it, untill certain button is pressed. could you help me with that?

function OnEvent(event, arg)

if event == "PROFILE_ACTIVATED" then

EnablePrimaryMouseButtonEvents(true)

elseif event == "MOUSE_BUTTON_PRESSED" and arg == 3 then

if IsKeyLockOn("capslock") then

repeat

MoveMouseTo(39785,17614)

PressMouseButton(2)

Sleep(10)

ReleaseMouseButton(2)

Sleep(2000)

MoveMouseTo(37258, 17492)

PressMouseButton(2)

Sleep(5)

ReleaseMouseButton(2)

Sleep(1000)

MoveMouseTo(28072, 34741)

PressMouseButton(2)

Sleep(10)

ReleaseMouseButton(2)

Sleep(1000)

MoveMouseTo(28550, 41665)

PressMouseButton(2)

Sleep(10)

ReleaseMouseButton(2)

Sleep(1000)

if not IsMouseButtonPressed(4) then break end

MoveMouseRelative(0,4)

Sleep(10)

PressMouseButton(2)

until not IsMouseButtonPressed(4) -- 4 = "Back"

end

end

end



https://redd.it/1jrjhqp
@r_lua
Luarocks Error: Attempted to index a nil value (field 'LUA_BINDIR')

Whenever I try to do anything with luarocks (ANYTHING) I get a litle pop up with this error:

\[string "src/luarocks/core/cfg.lua"\]:824: attempt to index a nil value (field 'LUA BINDIR')

stack traceback:

\[string "src/luarocks/core/cfg.lua"\]:824: in function 'luarocks.core.cfg.init

\[string "src/luarocks/loader.lua"\]:21: in main chunk \[C\]: in function 'require'

\[string "luarocks"\]:5: in main chunk \[C\]: in ?

I have LuaJIT installed as well as LOVE, which I am trying to get luarocks to work with. I have my paths correctly added, and everything SHOULD work, but it doesn't. I cant do any cmd commands with luarocks because everything returns the same error. I can't find anything online.


(Edit: When I say I was trying to use LOVE with luarocks, I'm not trying to install LOVE, I'm trying to install packages so I can used them WITH love, just FYI.)

https://redd.it/1jrv0tp
@r_lua
Just need some help with keeping letters with ASCII numbers just being singular letters

(This LUA code is specifically for the game Stormworks)
After a few hours, I learned how to decode ASCII letters (ex: 1008403 makes 84 as T and 03 as the 3rd letter), just need some help on saving those letters without them disappearing under a tick since for example 84 rapidly changes into a different number like for example again 65 (which makes A) for a new letter since the name becomes ASCII and only back to single letter(84 becomes 65 without actually adding a new letter because it gets immediately replaced) and 03 rapidly changed as well since it becomes 1st 2nd 3rd letter of the word etc(though the last 2 digits (ex:03 again) helps place one letter to another position like placing to a few pixels to somewhere of a monitor). (apologies if it's confusing since It's a bit hard to explain this).

BTW here's a view of my LUA code to help with it:
function onTick() AR1 =input.getNumber(1) ST1 = string.format("%00d", math.floor(AR1)) V1 = string.char(ST1 % 1000) AR2 =input.getNumber(2) end function onDraw() screen.drawText(32+(AR2*5), 32, V1) end

I'd really appreciate any help since chatGPT gave me a headache without doing anything useful to the code except making it worse.

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