Best Lua tutorial playlist?
I'm brand new to everything code. I started following "steve's teacher" but was wondering if he is the way to go? Is there someone who is the gold standard of tutorials?
https://redd.it/1ktpj3m
@r_lua
I'm brand new to everything code. I started following "steve's teacher" but was wondering if he is the way to go? Is there someone who is the gold standard of tutorials?
https://redd.it/1ktpj3m
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Would appreciate feedback on code/structure/best practices
Hello!
I'm somewhat new to Lua and Love2d. To get started, I thought I would make a matching style game as it would require me to try out the basics while having a clear goal I think is achievable.
This has gotten quite messy, with all kinds of 'classes' that are being passed all over the place, to and through each other. I'm planning on rewriting a lot of this with things I picked up from Olivine-Labs, but it doesn't really cover how classes/structures should be set up/contained/interact with others.
All constructive feedback is greatly appreciated.
GitHub Repository
https://redd.it/1ku2qvd
@r_lua
Hello!
I'm somewhat new to Lua and Love2d. To get started, I thought I would make a matching style game as it would require me to try out the basics while having a clear goal I think is achievable.
This has gotten quite messy, with all kinds of 'classes' that are being passed all over the place, to and through each other. I'm planning on rewriting a lot of this with things I picked up from Olivine-Labs, but it doesn't really cover how classes/structures should be set up/contained/interact with others.
All constructive feedback is greatly appreciated.
GitHub Repository
https://redd.it/1ku2qvd
@r_lua
GitHub
GitHub - Olivine-Labs/lua-style-guide: Olivine Labs Lua Style Guide
Olivine Labs Lua Style Guide. Contribute to Olivine-Labs/lua-style-guide development by creating an account on GitHub.
Coder for gmod
Im looking for coder / developer for my gmod server dayz server i need to fix some problmes in the files good price for the 1 who can do it
https://redd.it/1kuhi9j
@r_lua
Im looking for coder / developer for my gmod server dayz server i need to fix some problmes in the files good price for the 1 who can do it
https://redd.it/1kuhi9j
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
pipe operators in lua are weirdly satisfying
been playing with pluto, some superset of lua
local { http, json } = require "*"
local top_lua_repos = http.request("https://api.github.com/search/repositories?q=language:lua&sort=stars")
|> json.decode
|> |data| -> data.items
|> |items| -> items:filter(|r| -> r.stargazers_count > 1000)
for i = 1, math.min(5, #top_lua_repos) do
local repo = top_lua_repos[i]
print($"{repo.name} ({repo.stargazers_count} stars)")
end
reads like "fetch → decode → filter → print" instead of a bunch of nested calls. also has string interpolation which is nice.
https://redd.it/1kukuo0
@r_lua
been playing with pluto, some superset of lua
local { http, json } = require "*"
local top_lua_repos = http.request("https://api.github.com/search/repositories?q=language:lua&sort=stars")
|> json.decode
|> |data| -> data.items
|> |items| -> items:filter(|r| -> r.stargazers_count > 1000)
for i = 1, math.min(5, #top_lua_repos) do
local repo = top_lua_repos[i]
print($"{repo.name} ({repo.stargazers_count} stars)")
end
reads like "fetch → decode → filter → print" instead of a bunch of nested calls. also has string interpolation which is nice.
https://redd.it/1kukuo0
@r_lua
Any interest in a library for real arraylists?
local list = require('list')
for k, v in ipairs(list(2, 1, nil, "hello", 5)) do
print(k .. " : " .. tostring(v))
end
Prints:
1 : 2
2 : 1
3 : nil
4 : hello
5 : 5
for reference:
for k, v in ipairs({2, 1, nil, "hello", 5}) do
print(k .. " : " .. tostring(v))
end
prints
1 : 2
2 : 1
Im working on it as an experiment, trying to judge if people would actually want it with this post to see how far with it I should go. Should it have all the niceties tables have and a whole iterator library? Or is this just to be an experiment that I use personally for fun? Throw some comments this way to let me know (or upvotes I guess but I want to hear your thoughts)
https://redd.it/1kuohq3
@r_lua
local list = require('list')
for k, v in ipairs(list(2, 1, nil, "hello", 5)) do
print(k .. " : " .. tostring(v))
end
Prints:
1 : 2
2 : 1
3 : nil
4 : hello
5 : 5
for reference:
for k, v in ipairs({2, 1, nil, "hello", 5}) do
print(k .. " : " .. tostring(v))
end
prints
1 : 2
2 : 1
Im working on it as an experiment, trying to judge if people would actually want it with this post to see how far with it I should go. Should it have all the niceties tables have and a whole iterator library? Or is this just to be an experiment that I use personally for fun? Throw some comments this way to let me know (or upvotes I guess but I want to hear your thoughts)
https://redd.it/1kuohq3
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
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
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
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
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
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
YueScript - A MoonScript dialect with lots of new features. Transpiles into Lua.
https://yuenoscript.org/doc/
https://redd.it/1kuznhw
@r_lua
https://yuenoscript.org/doc/
https://redd.it/1kuznhw
@r_lua
yuenoscript.org
Documentation
Majordome v6.04 released : Lightweight declarative automation engine and data logger
https://github.com/destroyedlolo/Majordome/releases/tag/v6.04
https://redd.it/1kv3zno
@r_lua
https://github.com/destroyedlolo/Majordome/releases/tag/v6.04
https://redd.it/1kv3zno
@r_lua
GitHub
Release v6.04 : complete data feeding (PostgreSQL support) + automated diagram generation · destroyedlolo/Majordome
v6.04 Release 📯
📌 I'm pleased to announce the release of Majordome v6.04, a lightweight and powerful event driven automation tool and low code smart data logger.
What's new
complete Postgr...
📌 I'm pleased to announce the release of Majordome v6.04, a lightweight and powerful event driven automation tool and low code smart data logger.
What's new
complete Postgr...
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
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
But this is what I'm really confused about:
The above code prints 4.
However, if
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
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 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
https://redd.it/1kvemjb
@r_lua
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
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
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
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
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
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
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
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
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
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
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Big Updates to my Game Editor made on my iPad
https://www.youtube.com/watch?v=pb1mz01nk70
https://redd.it/1kw0c0q
@r_lua
https://www.youtube.com/watch?v=pb1mz01nk70
https://redd.it/1kw0c0q
@r_lua
YouTube
Made BIG Updates to my Game Editor on the iPads (Codea)
Made Updates for my game editor on my iPad. Going to use it to make games on Codea. In probably 2 month the first version of the editor will be release in the Codea Repo for you to use.
0:00 Introduction
0:27 Duplicate and Delete
1:10 Image Slice Editor…
0:00 Introduction
0:27 Duplicate and Delete
1:10 Image Slice Editor…
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
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
Leadwerks Community
Ultra Engine 0.9.9 Adds a Built-in Code Editor, Mesh Reduction Tools, and Thousands of Free Game Assets
Ultra Engine 0.9.9 is here with new features, improved usability, and access to thousands of free 3D assets to use in your games. This new update is the most stable and user-friendly version of our engine and editor to date. Revised Interface We've made great…
Solving Lua exercise
I will pay $100 to help me solve these last two Lua problems .
https://redd.it/1kwqsy1
@r_lua
I will pay $100 to help me solve these last two Lua problems .
https://redd.it/1kwqsy1
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
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
Need a guy who can help me finish my noscript. Please dm me if you are interested!
https://redd.it/1kwvg9h
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
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
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
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
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
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
GitHub
GitHub - ArkForgeLabs/Astra: 🔥 Blazingly Fast 🔥 web server runtime for Lua
🔥 Blazingly Fast 🔥 web server runtime for Lua. Contribute to ArkForgeLabs/Astra development by creating an account on GitHub.