Lua - Reddit – Telegram
Lua - Reddit
30 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
I need help finishing this plugin I've developed for Lightroom Classic. I will pay anyone that can help get it working. It's LUA
https://redd.it/1kusswl
@r_lua
Is there a way to push custom debug information from the Lua/C-API?

I'd like to provide Lua with additional debug info when interacting with it from C. I want to push __func__, __FILE__ and __LINE__ as the debug.getinfo() table fileds name, source/short_src and currentline, respectively. Is there an intended way to do this, would it require touching private APIs, or is it not possible at all?

I'm mainly targeting LuaJIT, but something compatible with all versions (PUC Lua 5.1 to 5.4 as well as LuaJIT) would be best.

https://redd.it/1kv07vu
@r_lua
YueScript - A MoonScript dialect with lots of new features. Transpiles into Lua.
https://yuenoscript.org/doc/

https://redd.it/1kuznhw
@r_lua
Grid and table question

I'm creating a 3d utility and ran into a dead end.

In the image the yellow bars represent one grid on the terrain. There is no set amount as to how many there are or can be. I'm trying to make a table aaccessible by these unset number or grid bars.

I originally tried something like -

grid = {}

for t=1, AmtOfBars, do ; grid[t\] = {} end

But when i try to add to the table like this -

table.insert ( grid[1\][1\], {

somedata = blah,

somedata2 = blah

})

I get runtime errors.

Any advice on how to set up this needed table > Thanks.

https://preview.redd.it/biec5ppsly2f1.png?width=2932&format=png&auto=webp&s=965a03bf7cb6ce0926430fcf9031f2de1f0a5f7e

https://redd.it/1kv7eh7
@r_lua
Lua's scoping behavior can be quite surprising. Bug or by design?!!

Please correct me! I haven't really used lua for a full project but I have played with it here and there! Alongside my nvim configuration.

But this is what I'm really confused about:



local a = 1

function f()
a = a + 1
return a
end

print(a + f())


The above code prints 4.

However, if a is not declared as local, it prints 3 (hmm).

I mean I try to get it, it's the lexical scoping and that the reference to a remains accessible inside f(). Still, from a safety standpoint, this feels error-prone.

Technically, if a is declared as local, and it's not within the scope of f(), the function should not be able to access or mutate. it should panic.
But it reads it and doesn't mutate globally (I guess that's should've been the panic )



To me, the current behavior feels more like a quirk than an intentional design.

I am familiar with rust so this is how I translated it :


fn main() {
let mut a = 1;


//I Know this one is as bad as a rust block can get, but it proves my point!

fn f(a: &mut i32) -> i32 {
*a += 1;
*a
}

println!("{}", a + f(&mut a)); // compiler error here!
}


Rust will reject this code at compile time because you're trying to borrow a as mutable while it's still being used in the expression a + f(&mut a).

And I assume gcc would throw a similar complier error!





https://redd.it/1kvemjb
@r_lua
New to lua

I can read Lua noscripts just fine, but something doesn't click with me. I've watched 20+ tutorials on it, yet what I don't get is every function. When do I use periods, colons, semicolons, parenthesis? When do I skip a line or add a variable?

https://redd.it/1kvh891
@r_lua
C API: "bad argument #1 to '?' (FileServerConfig expected, got FileServerConfig)"

I'm having trouble using metatables. Either I comment out the line marked with `[1]` and I get userdata-type-issues (all `__index`\-operations call my FileServerConfig-index-handler) or I get the error-message in the noscript.

My project (Lua-configured webserver uing the Linux uring-interface) is in early development and you can have my gitlab-address via PM. I hope, an advanced Lua C API-coder can help me with that.

EDIT: The Lua-Line is `fs_conf = createFileServerConfig()`, where the mentioned function runs `create_config_lua(...)`.

Following code gives me the error-report mentioned in the noscript:

static int create_config_lua(lua_State *L)
{
luaL_getmetatable(L, COMPONENT_LUA_METANAME);
lua_pushvalue(L, -1);
lua_setfield(L, -2, "__index");
luaL_setmetatable(L, COMPONENT_LUA_METANAME); // [1]

luaL_setfuncs(L, lua_file_m, 0);
luaL_setmetatable(L, COMPONENT_LUA_METANAME);
lua_pushlightuserdata(L,(void *) create_config());
luaL_setmetatable(L, COMPONENT_LUA_METANAME);
return 1;
}

https://redd.it/1kvsofp
@r_lua
interactive ways to learn lua?

ive tried reading the lua website but i feel as though im not learning. does anyone know interactive ways to learn it?

https://redd.it/1kvw6fd
@r_lua
Ultra Engine 0.9.9 Released

Hi, I just wanted to let you know the new version of my Lua-compatible game engine has been released: https://www.leadwerks.com/community/blogs/entry/2872-ultra-engine-099-adds-a-built-in-code-editor-mesh-reduction-tools-and-thousands-of-free-game-assets/

https://preview.redd.it/02adopcqz53f1.jpg?width=1280&format=pjpg&auto=webp&s=3ce16cd9b6cd01351510a0da158ee756c67b5f77

Based on community feedback and usability testing, the interface has undergone some revision and the built-in code editor from Leadwerks has been brought back, with a dark theme. Although Visual Studio Code is an awesome IDE, we found that it includes a lot of features people don't really need, which creates a lot of visual clutter, and a streamlined interface is easier to take in.

https://preview.redd.it/iabye3tvz53f1.jpg?width=1960&format=pjpg&auto=webp&s=6631d4fc6ca17e138e1777819c3846fd6ab98454

A built-in downloads manager provides easy access to download thousands of free game assets from our website. Manually downloading and extracting a single zip file is easy, but when you want to quickly try out dozens of items it adds a lot of overhead to the workflow, so I found that the importance of this feature cannot be overstated.

https://preview.redd.it/16r8sm80063f1.png?width=1462&format=png&auto=webp&s=2ad738b688962f6401dcea5feb1eac4d45906d30

A mesh reduction tool provides a way to quickly create LODs or just turn a high-poly mesh into something usable. This is something I really discovered was needed while developing my own game, and it saves a huge amount of time not having to go between different modeling programs.

https://i.redd.it/zfv4v472063f1.gif

Let me know if you have any questions and I will try to answer them all. Thanks!

https://redd.it/1kw15ha
@r_lua
Solving Lua exercise

I will pay $100 to help me solve these last two Lua problems .

https://redd.it/1kwqsy1
@r_lua
Looking for a fivem backend dev! (Paid)

Need a guy who can help me finish my noscript. Please dm me if you are interested!

https://redd.it/1kwvg9h
@r_lua
Macro lua auto click G hub Logitech X Pro Superlight

Olá, a tempos venho vendo que aqui no comunidade, quando si ah uma duvida referente a scrip lua, os brabo estão aqui.
Então! eu tenho um scrip que uso e sem nenhum problema com ele, mas queria adicionar a função de auto click tambem para funcionar junto com todo o restante.

O quero adicionar o seguinte comando, o mouse ficar clicando o botao esquerdo continuamente enquanto estiver presionado e para ao soltar logitecamente.


Atualmente uso esse noscript;


local Spray_Randomize = math.random(29, 31)

local AK47_Pattern = {

{ x = 1, y = 1 }, { x = -1, y = -1 },

}



EnablePrimaryMouseButtonEvents(true)



function OnEvent(event, arg)

if event == "MOUSE_BUTTON_PRESSED" and arg == 1 then

if IsKeyLockOn("capslock") then

repeat

Sleep(9)

MoveMouseRelative(0, 6)

Sleep(9)

MoveMouseRelative(0 ,-6)

until not IsMouseButtonPressed(1)

end

end

end



https://redd.it/1kwyjzz
@r_lua
Astra v0.20 released - A Lua 5.1-5.4/JIT/Luau web server runtime

Astra is a Lua 5.1-5.4/JIT/Luau runtime written in Rust using mlua project. The runtime tries to be as easy to use and performant as possible, and focus mainly for web servers. Its aim is to be a single binary that you can drop anywhere to run your servers, with the speed and safety of Rust, but without having the complexity and build times. Almost all of the components is written in Rust using different popular crates.

Example usage:

-- Create a new server
local server = Astra.http.server:new()

-- Register a route
server:get("/", function()
return "hello from default Astra instance!"
end)

-- Configure the server
server.port = 3000

-- Run the server
server:run()

The runtime currently features HTTP1/2 server (axum), client (reqwest), SQL driver (sqlx), async tasks (tokio), crypto (sha2, sha3, base64), JSON (serde_json), cookies (tower), and many other smaller but useful things such as pretty printing, data validation, ...

In the v0.20 release, there has been a huge refactor in the code structure and API design, making it finally somewhat usable outside. There has also been some production testing internally at ArkForge and some other users in startups, although I would not personally recommend full production use of it as its quite young.

I am the main developer of it as well, feel free to AMA

https://redd.it/1kxhnb8
@r_lua
Can anyone tell me how to install lua and luarocks in user environment on Linux?

So the thing is i don't want to download this with sudo privilege. And building the package doesn't seem very straightforward to me. I am not able to make luarocks work.
I am beginner in Lua, I have worked with python package managers such as lua and apparently the setup of luarocks is not as straightforward as uv.
Can anyone walk me through the installation and project setup. I could move past installing a luarocks package and run it in the project. All in all I am not able to configure.

https://redd.it/1kxkm8m
@r_lua
Can Roblox Studio programming be talked about in this reddit?

Roblox Studio's main coding language is Lua (or, Luau) but it doesn't seem very appropriate to talk about here. Otherwise, is this OK?

https://redd.it/1kxwwcr
@r_lua
Beat Iphone app for learning lua

Ok guys I dont want crap about how a laptop would be better or websites or your 10 paragraphs in 1 message (Im not gonna read all that) I want an app like mimo but its teaches lua, that has a dashboard that is good. Dont go ahead and yap just give me an APP (not website) and explain why its good

https://redd.it/1kyezmu
@r_lua
Starting lua?

Can somebody recommend me to a brief introduction to lua? maybe roblox sided?
Im at the level of making flappy bird game in python with tkinter. Id be glad for any links and guides ty!
All opinions are helpful

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