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
Problems while installing LÖVR on EndeavourOS linux.

Hi, recently I tried to install LÖVR by compiling it from source. I cloned the repo and ran

$ mkdir build

$ cd build

$ cmake ..

$ cmake --build .

Unfortunately, docs don't list what to do after this and probably assume some level of CMake profficiency:
[https://lovr.org/docs/Compiling#linux](https://lovr.org/docs/Compiling#linux)

They say how to run LÖVR with VR, but that's not what I want to do right now.

Now, if i run `lovr` file from bin subdirectory, I get this error:

lovr: /usr/src/debug/glfw/glfw-3.4/src/window.c:868: glfwGetWindowAttrib: Assertion `window != NULL' failed.
Aborted (core dumped)

If I run `sudo make install .` I get different error:

CMake Error at luajit/src/cmake_install.cmake:81 (file):
file INSTALL cannot find
"/home/user1/dev/lovr/first_touch/build/luajit/src/luajit": No such file
or directory.
Call Stack (most recent call first):
luajit/cmake_install.cmake:47 (include)
cmake_install.cmake:48 (include)

I do not really use CMake that often and am not fluent in compiling software from source.

What have I done wrong? And what should I do now?

Thanks in advance.

https://redd.it/1i0bzno
@r_lua
Can a LUA noscript be used to replace a file that is within a ZIP file?

I am very new to this so I apologize if this is a stupid question.

I'm currently designing a Reaper Theme that will have it's own theme adjuster (the adjuster is the lua noscript), and I'm trying to plan ahead a bit and figure out what I should or should not be investing time into.

Something I wanted for the theme is the ability to swap out theme images using the noscript, similar to this noscript (it's called the Theme Assembler which is used in conjunction with the Theme Assembler Theme).

Normally, a theme and all it's files are zipped within a .ReaperThemeZip file (but it doesn't need to be). In order for the Theme Assembler noscript to work however the Theme Assembler theme must be unpacked.

Want I want to know is if it's possible to accomplish the same thing if the theme was in its zipped state with the .ReaperThemeZip. Basically to use a LUA noscript to drop in and replace images within the .ReaperThemeZip.

https://redd.it/1i0hz0y
@r_lua
Can anyone tell me what this code does?

I found it in a YouTube video and I was just curious.

`loadstring("function IllIlllIllIlllIlllIlllIll(IllIlllIllIllIll) if (IllIlllIllIllIll==(((((919 + 636)-636)*3147)/3147)+919)) then return not true end if (IllIlllIllIllIll==(((((968 + 670)-670)*3315)/3315)+968)) then return not false end end; local IIllllIIllll = (7*3-9/9+3*2/0+3*3);local IIlllIIlllIIlllIIlllII = (3*4-7/7+6*4/3+9*9); function IllIIIIllIIIIIl(IIllllIIllll) function IIllllIIllll(IIllllIIllll) function IIllllIIllll(IllIllIllIllI) end end end;IllIIIIllIIIIIl(900283);function IllIlllIllIlllIlllIlllIllIlllIIIlll(IIlllIIlllIIlllIIlllII) function IIllllIIllll(IllIllIllIllI) local IIlllIIlllIIlllIIlllII = (9*0-7/5+3*1/3+8*2) end end;IllIlllIllIlllIlllIlllIllIlllIIIlll(9083);local IllIIllIIllIII = loadstring;local IlIlIlIlIlIlIlIlII = "local Fluent = loadstring(game:HttpGet("https://github.com/dawid-noscripts/Fluent/releases/latest/download/main.lua"))() local UserInputService = game:GetService("UserInputService") local LocalPlayer = game:GetService("Players").LocalPlayer local MarketplaceService = game:GetService("MarketplaceService") local GamePassID = 1029112746 local Positions = { ["Dock"] = Vector3.new(445.53, 40.24, 392.25), ["Sweet Shop"] = Vector3.new(732.36, 156.41, -934.99), ["Gift-Making Place"] = Vector3.new(919.32, 235.89, -1137.43), ["Church"] = Vector3.new(998.83, 231.93, -941.85), } local PositionButtons = {} local function DisplayMessage(message, color) Fluent:Notify({ Title = "Access Denied", Content = message, Duration = 5, Image = "error", Color = color }) end local function CheckAccess(player) local success, hasPass = pcall(function() return MarketplaceService:UserOwnsGamePassAsync(player.UserId, GamePassID) end) if success and hasPass then return true else return false end end if not CheckAccess(LocalPlayer) then DisplayMessage("You do not have access to this noscript.\nPlease buy the game pass.\nContact @notyashlol on Discord for help.", Color3.fromRGB(255, 0, 0)) return else local welcomeMessage = "Welcome to Manjiro Script Hub!" if LocalPlayer.Name == "yashgamer2233" then welcomeMessage = "Hello, Master! Access granted." elseif LocalPlayer.Name == "Karina_Siwa2" then welcomeMessage = "Hello, Mistress! Access granted." end DisplayMessage(welcomeMessage, Color3.fromRGB(0, 255, 0)) end local Window = Fluent:CreateWindow({ Title = "Manjiro Script Hub", SubTitle = "Save, Load, and Manage Positions with Ease!", Theme = "Dark", TabWidth = 160, Size = UDim2.fromOffset(580, 460), Acrylic = true, }) local Tabs = { ManagePositions = Window:AddTab({ Title = "Manage Positions", Icon = "save" }) } local function RefreshPositionButtons(section) for _, button in ipairs(PositionButtons) do button:Destroy() end PositionButtons = {} for name, position in pairs(Positions) do local button = section:AddButton({ Title = "Load: " .. name, Callback = function() if LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("HumanoidRootPart") then LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(position) Fluent:Notify({ Title = "Success", Content = "Position loaded: " .. name, Duration = 5, Image = "check" }) else Fluent:Notify({ Title = "Error", Content = "Character or HumanoidRootPart not found.", Duration = 5, Image = "x" }) end end }) table.insert(PositionButtons, button) end end do local ManageSection = Tabs.ManagePositions:AddSection("Position Management") Tabs.ManagePositions:AddInput("PositionName", { Title = "Position Name", Default = "", Placeholder = "Enter a position name...", Callback = function(value) positionName = value end }) Tabs.ManagePositions:AddButton({ Title = "Save Position", Callback = function() if not positionName or positionName == "" then Fluent:Notify({ Title = "Error", Content = "Please enter a valid position name.", Duration = 5, Image = "x" }) return end local character = LocalPlayer.Character if character and character:FindFirstChild("HumanoidRootPart") then Positions[positionName] = character.HumanoidRootPart.Position SavePositionsToFile() Fluent:Notify({ Title = "Success",
Content = "Position saved: " .. positionName, Duration = 5, Image = "check" }) RefreshPositionButtons(ManageSection) else Fluent:Notify({ Title = "Error", Content = "Character or HumanoidRootPart not found.", Duration = 5, Image = "x" }) end end }) RefreshPositionButtons(ManageSection) end Fluent:Notify({ Title = "Manjiro Script Hub", Content = "The noscript has been loaded and is ready to use!", Duration = 8 }) "IllIIllIIllIII(IlIlIlIlIlIlIlIlII,IIIIIIIIllllllllIIIIIIII)()")()`



https://redd.it/1i0xlc0
@r_lua
Help needed - luarocks test --prepare always erroring on Windows

I'm trying to install a package luarocks. Specifically I want to

1. clone my package
2. install all of its dependencies
3. install all of its test_dependencies
4. run the unittests (via busted)

My understanding is that I can do #2 and #3 by calling luarocks test my_package-scm-1.rockspec --prepare and then do #4 with luarocks test --test-type busted. #4 is working fine. My problem is with #3. And possibly #2.

I simply cannot seem to get luarocks test --prepare to run on Windows. It looks like despite the luarocks test --help documentation saying that --prepare does not run any tests and just installs dependencies, it looks like --prepare still actually does run some tests. In my logs I can clearly see Error: test suite failed

This is the GitHub workflow run: https://github.com/ColinKennedy/mega.vimdoc/actions/runs/12772422930/job/35601914793

And the logs are here

And the GitHub workflow file

From what I can guess from reading luarocks source code, it looks like unittests are running for some package, somewhere, and instead of showing the error it's just defaulting to the generic Error: test suite failed error message that can be seen in the logs.

https://redd.it/1i1anib
@r_lua
anyone know why my resource manifest isnt working?

fx_version 'cerulean'
game 'gta5'

author 'Jacobmaate'
denoscription 'FIB Police (FIBP) Pack'
version 'v3.03'

files {

'data/vehicles.meta',
'data/carvariations.meta',
'data/carcols.meta',
'data/handling.meta',
'data/dlctext.meta',
'data/vehiclelayouts.meta',
'data/jmfibpolicegame.dat151.rel',
'data/buffaloac
sounds.dat54.rel',

}

data_file 'HANDLING_FILE' 'data/handling.meta'
data_file 'VEHICLE_METADATA_FILE' 'data/vehicles.meta'
data_file 'CARCOLS_FILE' 'data/carcols.meta'
data_file 'VEHICLE_VARIATION_FILE' 'data/carvariations.meta'
data_file 'DLC_TEXT_FILE' 'data/dlctext.meta'
data_file 'VEHICLE_LAYOUTS_FILE' 'data/vehiclelayouts.meta'
data_file 'AUDIO_GAMEDATA' 'data/jmfibpolice_game.dat'
data_file 'AUDIO_SOUNDDATA' 'data/buffaloac_sounds.dat'
client_noscript 'vehicle_names.lua'

https://redd.it/1i1bwb8
@r_lua
Server-side to client-side adaptation

I need to adapt this server-side tool to client-side. I got something with ChatGPT, but it's not what I need.

https://drive.google.com/file/d/1YK0eddB43ZPFNmBUWCQj0LDzyfGkYe12/view?usp=sharing \- Original TAS file.

https://drive.google.com/file/d/1Czn-G6EyZzcohANJuJs9d6oGLSDRypQo/view?usp=sharing \- My TAS file

https://redd.it/1i1iybn
@r_lua
How do i make a lua that downloads from something like discord into a folder?

When i search on google all it gives is download lua

https://redd.it/1i1vvxq
@r_lua
Help rainbow colour Lua how would I write this so it gave me a rainbow colour name tag instead of just one colour been trying for months iv seen other people with it but I can’t figure it out please help 🙏
https://redd.it/1i22nff
@r_lua
[noob] Replace single space in between non-space characters with wildcard

How to replace a single space (` `) in between non-space characters with `.*`?

I'm writing a simple Lua wrapper (I don't know any programming) to rebuild the string that gets passed to rg (grep alternative) where a single space between non-space characters imply a wildcard. To use a literal space instead of the wildcard), add another space instead (i.e. if the wildcard is not desired and and a literal space is wanted, use 2 spaces to represent a literal space, 3 spaces to represent 2 spaces, etc.).

Example: `a b c d` becomes `a.*b.*c.*d`, `a b c d` becomes `a b.*c.*d`.

I have something like this so far `query:gsub("([^%s])%s([^%s])", "%1.*%2")` but it only results in `a.*b c.*d` (`word word word word` correctly becomes `worda.*wordb.*wordc.*wordd` so I don't understand why) .

-----

For handling literal spaces, I have the following:

local function handle_spaces(str)
str = str:gsub(" +", function(match)
local length = #match
if length > 2 then
return string.rep(" ", length - 1) -- reduce the number of spaces by 1
else
return " " -- for exactly two spaces, return one space
end
end)
return str
end

https://redd.it/1i27mg8
@r_lua
im a stupid windows user and need help with luarocks

Basically im trying to install the package cjson with luarocks, running the following command:

`luarocks install lua-cjson CC=gcc LD=gcc`


It start compiling normally, but as it reaches cjson.dll it prints this error

gcc -shared -o cjson.dll lua_cjson.o strbuf.o fpconv.o C:/lua/bin/bin/../lib -lmsvcr80
C:/Program Files (x86)/gcc/mingw32/bin/../lib/gcc/i686-w64-mingw32/14.2.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find C:\lua\bin\..\lib: Permission denied
collect2.exe: error: ld returned 1 exit status

Error: Build error: Failed installing cjson.dll in C:\lua\bin\bin/../share/luarocks/rocks/lib/luarocks/rocks/lua-cjson/2.1.0.10-1/lib

Im sure the error lies in the LD of gcc, but ive never ran in to this problem. Im confused, can someone help, please?


https://redd.it/1i2am0f
@r_lua
Is there a lack of dark vsc themes?
https://redd.it/1i2a15u
@r_lua
Lua beginner tips.

So im starting to learn lua and i have a couple of things i wanna know

First of all can i use it on windows, i tried to install lua on my system couple of times and the system still dont recognise it (help me out in this matter)


Second thing if you have any recomendation to somewhere i can leaen from i would appreciate it (a youtuber or somthing)

https://redd.it/1i2m7y4
@r_lua
Openresty docker compose

How to install any module (Ex: resty.http,...) in docker compse?

https://redd.it/1i2talp
@r_lua
Can someone help me adding a cooldown bar connected to an action in a game, in a game/mod noscript?



https://redd.it/1i30wxw
@r_lua
Import module to use in Lua interactive mode question

I am completely new to Lua. I want to use a lib call eff.lua. By following its instruction, I install this lib using $ luarocks --local install eff. It accomplished installation successfully.

Installing https://luarocks.org/eff-5.0-0.src.rock
eff 5.0-0 is now installed in /home/ubuntu/.luarocks (license: MIT)

However, when attempting to load/ import and use the module in interactive mode after executing the lua command, the lua interactive mode displays errors.

$ lua
Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio
> require "eff"
> local Write = inst()
stdin:1: attempt to call global 'inst' (a nil value)
stack traceback:
stdin:1: in main chunk
C: ?

I thought it is because the path problem in the first place. The require "eff" looks working. So I am confused.

How can I fix this error? Thanks.

https://redd.it/1i3bw09
@r_lua
Alchemer Lua set url variable or custom variable

This is driving me crazy. Even with an if else statement I cannot figure out how to evaluate two variables and set one of them. Any help is greatly appreciated

This is what I have:

questionID = 111
-- Get the values from the URL and invite
urlval = urlvalue("reg") inviteval = 'invite("custom 5")'
-- Determine which value to use
if urlval ~= nil and urlval ~= ""then
value = urlval
elseif invite
val ~= nil and inviteval ~= "" then
value = invite
val
else
value = nil
-- Set the value for the question
if value ~= nil then setvalue(questionID, value)
end




https://redd.it/1i3fn4q
@r_lua
How to learn Lua

How to learn lua? i wanna learn it for roblox because i wanna make a game and i hope i success with that
if anyone can help i will be appreciated :)

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