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
Is luarocks compatible with luau?

I have downloaded and ran luau on my computer, but when i tried to use it with luarocks (normal lua works fine) the require function gave an error:

test.lua:1: error requiring module
stacktrace:
C function require
test.lua:1

any ideas?

https://redd.it/1fri1bf
@r_lua
Recommend a Good Lua Codebase to Study

Is there a good open source lua codebase you'd recommend looking at for a beginner trying to grok the ways of lua? I can muddle through with a lot of googling and searching in the lua docs, but I think I might benefit from just looking at good lua code.

https://redd.it/1fs6aew
@r_lua
Ikibooru - a booru of generic files written almost entirely in Lua
https://mid.net.ua/ikibooru.html

https://redd.it/1fsanmh
@r_lua
So I tried Roblox Studio...

It eats 2GB RAM.

Has a Qtitan library around Qt5. LibFbxSDK probably the one from AutoDesk. WebView2 from Microsoft.

And yes, Luau is an interesting extension to Lua...

https://redd.it/1fsq7z6
@r_lua
fengari-web: Helper functions & ordered, async noscript loader

I've continued messing with Fengari, using it with some js libraries (pixi-js primarily). I do not want to use node, npm, webpack, etc. And, I got tired of require() putting deprecation warnings in my console about synchronous requests.

So, I created this loader and some global helper functions. If someone knows an easier way to do this, please share! If it's somehow useful or interesting...here it is:

<noscript type="application/lua">
js=require('js')
window=js.global
document=window.document

local modules={
'testmod.fengari',
'dramaterm.fengari'
}

await=function(p)
local pco=coroutine.running()
p'then'
coroutine.resume(pco,...)
end)
,result=coroutine.yield()
return result
end

Array = js.global.Array

-- Helper to copy lua table to a new JavaScript Object
-- e.g. Object{mykey="myvalue"}
function Object(t)
local o =
js.new(js.global.Object)
for k, v in pairs(t) do
assert(type(k) == "string" or js.typeof(k) == "symbol", "JavaScript only has string and symbol keys")
o[k] = v
end
return o
end

function import(js,t)
-- "imports" parts of a js library into global, for convenience
for
, v in ipairs(t) do
ENV[v]=js[v]
end
end

local loadScript=function(src)
local noscript = document:createElement('noscript')
noscript.type='application/lua'
local response=await(window:fetch(src))
local scr=await(response:text())..'\nloader(\''..src..'\')'
noscript.innerHTML=scr
document.head:append(noscript)
window.console:log('Loaded lua noscript',coroutine.yield())
end

local load=function(t)
for
,v in ipairs(t) do
loadScript(v)
end
end

loader=coroutine.wrap(load)
loader(modules)
</noscript>

https://redd.it/1ftkmqa
@r_lua
roblox banner tracker

hey, anyone knows how i can do a banner tracker of a game from roblox? idk if i need to use a noscript made in LUA to get the banner information or smth like that. I want to make this for my discord server

https://preview.redd.it/x26yk32so9sd1.png?width=508&format=png&auto=webp&s=2e2df773880e413822080ad47f6dd77cd79c8c67

https://redd.it/1fu7lhc
@r_lua
Lua & CMake

[Some learning materials](https://github.com/PacktPublishing/Integrate-Lua-with-CPP) recommend integrating [lua](https://www.lua.org/) into your project by manually download the code and unzip it into a subdir. Then use normal source code access and linking to combine its functions with your project.

Many people (like me) use cmake to manage most of the compiling of projects. So I wanted cmake to pull repos and install temporary files without leaving them in the repo. Lua isnt the only external project i regularly reference.

It took me a while to work out exactly how, but i have made a small CMakeLists.txt file that downloads Lua into a build directory for where you can call functions etc without leaving the entire code base behind inside your repo.

[https://github.com/seanbutler/lua-embed-in-cpp-with-cmake](https://github.com/seanbutler/lua-embed-in-cpp-with-cmake)

* I suspect there are still errors in the cmakelist.txt Ive made and would appreciate an experts eye on it and feedback if possible. Do any people on here have similar cmake and lua (accessible, understandable) noscripts in their toolbox?

thanks.

https://redd.it/1fuc4gk
@r_lua
fengari-web: improved loader noscript, sends event to all loaded noscripts when the page (and all the lua noscripts) are really loaded

This is an evolution of my previous post, this now does everything I wanted. It allows control over the order of lua noscript loading, enforces sequential loading, and solves the problem of missing window.onload events (or them firing waaay before the lua noscripts are finished loading). loadScript can also be called from any coroutine in global, so dynamic loading of noscripts is easy.

js=require('js')
window=js.global
document=window.document

-- global fengari helper/utility functions
await=function(p)
local pco=coroutine.running()
p'then'
coroutine.resume(pco,...)
end)
,result=coroutine.yield()
return result
end

Array = js.global.Array

-- Helper to copy lua table to a new JavaScript Object
-- e.g. Object{mykey="myvalue"}
function Object(t)
local o =
js.new(js.global.Object)
for k, v in pairs(t) do
assert(type(k) == "string" or js.typeof(k) == "symbol", "JavaScript only has string and symbol keys")
o[k] = v
end
return o
end

function elevate(from,members)
-- "elevates" {members} of a js library (from) into global, for convenience
for
, v in ipairs(members) do
ENV[v]=from[v]
end
end

loadScript=function(src)
-- find the name of the running coroutine (in global)
local co,coname=coroutine.running()
for k,v in pairs(
ENV) do
if (v==co) then
coname=k
break
end
end
if coname==false then
window.console:error('loadScript must be called from a global running coroutine')
return false
else
local noscript = document:createElement('noscript')
noscript.type='application/lua'
noscript.id=src
local response=await(window:fetch(src))
local scr=await(response:text())..'\ncoroutine.resume('..coname..',\''..src..'\')'
noscript.innerHTML=scr
document.head:append(noscript)
window.console:log('Loaded lua noscript',coroutine.yield())
return noscript
end
end

local load=function(t)
local noscripts={}
for ,v in ipairs(t) do
table.insert(noscripts,loadScript(v))
end
for
,noscript in ipairs(noscripts) do
noscript:dispatchEvent(js.new(window.Event,"fullyLoaded"))
end
end

local modules={
'Config.fengari',
'dramaterm.fengari'
}



loaderco=coroutine.create(load)
coroutine.resume(loaderco,modules)

https://redd.it/1fujswq
@r_lua
Learning Lua.

I’ve been learning Lua for Roblox, I know most of the basics and the advanced parts a little.

Is there any specific tip on how to actually master it..?

https://redd.it/1fuj71g
@r_lua
How can I find out the bytecode version if it is not at the beginning of the file?
https://redd.it/1fvl5qe
@r_lua
Terminating Lua Scripts from C++

I need to unconditionally terminate Lua noscripts called from my C++ code.

I've tried using Lua hooks and lua_error, but this doesn't fully terminate noscripts due to internal pcalls. Using lua_close causes segmentation faults because it closes the Lua state while lua_pcall is still active.

I attempted C++ exception handling by throwing exceptions, but pcall catches them, preventing proper termination. My last resort is using longjmp, which I want to avoid in a C++ codebase.

I receive multiple Lua noscripts that run in a single thread with an interval-based scheduler. If a noscript doesn't complete within its defined execution interval (e.g., 500ms), it needs to be terminated.

I’m currently using Lua hooks to check execution time every 10,000 instructions and plan to switch to Linux timers later.

What are my options to safely terminate Lua noscripts in this environment? Any help would be appreciated!



https://redd.it/1fw36w0
@r_lua
can you please fix for me ?

can you please fix this for me idk its possible or not . is there any way to left click with 3-4 reapeat for rapidfire without right click or any other I know there is right click version

i want a lua like just ScrollLock on/off and 1 left click 3-4 reapeat + MouseRelative move

EnablePrimaryMouseButtonEvents(true);

function OnEvent(event, arg)

if IsKeyLockOn("ScrollLock") then

if IsMouseButtonPressed(1) then

repeat

if IsMouseButtonPressed(1) then

repeat

MoveMouseRelative(0, 4)

for _ = 1, 4 do

PressMouseButton(1)

Sleep(5)

ReleaseMouseButton(1)

end

until not IsMouseButtonPressed(1)

end

until not IsMouseButtonPressed(1)

end

end

end

https://redd.it/1fw579b
@r_lua
Easy Gui designing with export code tool

Is there no tool which i can easily drag and drop buttons labels whatever to design an gui and afterwards export the lua the only one i can think of is in roblox studio which is crazy ive been looking for a few days and couldnt find any software thats insane

https://redd.it/1fw6z24
@r_lua
Thinking about learning lua

In short I'm thinking about learning lua. Is it a fun language like python and what's the main reason ppl use it. Is it versatile or fun. This is coming from a junior java dev.

https://redd.it/1fw9km9
@r_lua
Contributing to building a new package manager

Hey everyone!

We’re working on Nebula Pack, a new open-source package manager for Lua, and we’re looking for collaborators—beginners very much included! If you’ve ever been frustrated with LuaRocks, especially when trying to set it up on non-Unix systems, we’re on the same page. That’s exactly why we’re building Nebula Pack: to make something way more intuitive and accessible.

The project’s backend is being built in Go, and we’re handling the CLI in Go too, with plans to create the compiler in Rust (but we’re open to alternatives). Right now, we’ve got a solid API in beta, but there’s still a ton to do—adding features, building a database, and automating configurations for C/low-level language projects so they play nicely as Lua modules.

No matter your experience level, this is a great chance to dive into a real-world project, learn from the process, and help create something cool that could really help the Lua and LOVE2D community.

Sound interesting? Check out the project on GitHub and feel free to jump in. Whether you’ve got experience or you’re just getting started, we’d love to have you. Reach out to me at keagangilmore@gmail.com if you’ve got any questions, or just want to chat!

GitHub Links:
- My Github
- Nebula Pack

Let’s make something awesome together!

https://redd.it/1fwplgm
@r_lua
Why io.tmpfile() requires admin privilege?

Hi. Just picked up Lua. this code doesn't run without admin privilege in windows. I wonder why creating tmpfile needs privilege. I assume it creates the file in the memory and not on storage. I'm on windows. the code I'm trying to run:

f = assert(io.tmpfile())
f:write ("some data here") -- write to it

https://redd.it/1fwuuzk
@r_lua
Need help finding a game engine to create mobile 2d games on lua

Im trying to search some good games engines to make 2d mobile games and it must be free and im also good at lua. Hope someone helps

https://redd.it/1fxn104
@r_lua
Roblox private servers

I know next to nothing about coding. When a Roblox private server link is clicked, it first opens a browser tab with a "roblox.com/share?code=(random numbers and letters) which changes to "roblox.com/games/(game number and name)?privateServerLinkCode=" can someone help me connect directly to the private server once the link is clicked? (my goal is to join a private server faster than anyone else can join) Any help would be much appreciated.

https://redd.it/1fxywu6
@r_lua
Can Someone make me a esp line hack for the game Graal Online era?

Hi can someone make a esp line that takes you to the trash and the mushrooms in the game?

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