Lua beginner
Hey everyone, I'm someone who loves programming and tried lua in nvim and liked the syntax but I want more than just creating plugins in nvim (which are complex and beautiful).
https://redd.it/1nlapjt
@r_lua
Hey everyone, I'm someone who loves programming and tried lua in nvim and liked the syntax but I want more than just creating plugins in nvim (which are complex and beautiful).
https://redd.it/1nlapjt
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
New coder (hopefully)
I have never tried coding and ik it's not for the weak lol but like how do I get started on learning and do I have to use my PC or are there any apps you recommend for mobile as well or any YouTubers that are good at explaining for beginners I plan on doing only like noscripting and small stuff before I get into the big stuff.
https://redd.it/1nlxdqt
@r_lua
I have never tried coding and ik it's not for the weak lol but like how do I get started on learning and do I have to use my PC or are there any apps you recommend for mobile as well or any YouTubers that are good at explaining for beginners I plan on doing only like noscripting and small stuff before I get into the big stuff.
https://redd.it/1nlxdqt
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
I just released a new Application Development Framework made with lua.
https://i.imgur.com/DaxSdBW.png
https://redd.it/1nm0qvo
@r_lua
https://i.imgur.com/DaxSdBW.png
https://redd.it/1nm0qvo
@r_lua
Imgur
Discover the magic of the internet at Imgur, a community powered entertainment destination. Lift your spirits with funny jokes, trending memes, entertaining gifs, inspiring stories, viral videos, and so much more from users.
Cannot install luarocks' lsqlite3
Cannot install luarocks' lsqlite3 on macOS 26. Cannot really find a lot on how to solve it. Any ideas?
https://redd.it/1nm0trp
@r_lua
Cannot install luarocks' lsqlite3 on macOS 26. Cannot really find a lot on how to solve it. Any ideas?
sudo luarocks install lsqlite3 --forceInstalling [https://luarocks.org/lsqlite3-0.9.6-1.rockspec](https://luarocks.org/lsqlite3-0.9.6-1.rockspec)Error: Failed extracting /private/tmp/luarocks\_luarocks-source-lsqlite3-0.9.6-1-6157402/lsqlite3\_v096.zip: failed extracting /private/tmp/luarocks\_luarocks-source-lsqlite3-0.9.6-1-6157402/lsqlite3\_v096.ziphttps://redd.it/1nm0trp
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
i need help with mine GMOD code again
okay, so, i tried fixing my code(i hope i did fixed it and not missed up), but the current problem with it, is at the line
`function SWEP:PrimaryAttack()`
`if (CLIENT) then return end`
if i put end at the function SWEP, it says "global self nil value" error, but if i DONT put end in there, it requires me to put the end in it. is there any way to fix it? or i just putted wrong, useless function in it?
P.S. if someone is willing to help me, there is the full code, so you can say if it function being useless in it, or it requires another function to work properly
SWEP.HitDistance = 49
function SWEP:Initialize()
self:SetWeaponHoldType( "melee2" )
end
function SWEP:PrimaryAttack()
if (CLIENT) then return end
local ply = self:GetOwner()
ply:LagCompensation(true)
local shootpos = ply:GetShootPos()
local endshootpos = shootpos + ply:GetAimVector() * 75
local tmin = Vector( 1, 1, 1 ) * -10
local tmax = Vector( 1, 1, 1 ) * 10
local tr = util.TraceHull( {
start = shootpos,
endpos = endshootpos,
filter = ply,
mask = MASK_SHOT_HULL,
mins = tmin,
maxs = tmax } )
if not IsValid(tr.Entity) then
tr = util.TraceLine ( {
start = shootpos,
endpos = endshootpos,
filter = ply,
mask = MASK_SHOT_HULL } )
end
local ent = tr.Entity
if(IsValid(ent) and (ent:IsPlayer() or ent:IsNPC() ) ) then
self.Weapon:SendWeaponAnim(ACT_VM_HITCENTER)
ply:SetAnimation(PLAYER_ATTACK1)
ply:EmitSound(HitSound)
ent:SetHealth(ent:Health() - 140)
ent:TakeDamage(140, ply, ply)
if(ent:Health() <=0) then
ent:Kill()
ply:SetHealth( math.Clamp(ply:Health() +0, 1, ply:GetMaxHealth() ) )
else
self.Weapon:SendWeaponAnim(ACT_VM_MISSCENTER)
ply:EmitSound(SwingSound)
end
self:SetNextPrimaryFire(CurTime() + self:SequenceDuration() + 0.1)
ply:LagCompensation(false)
end
function SWEP:CanSecondaryAttack()
return false end
https://redd.it/1nm8pl2
@r_lua
okay, so, i tried fixing my code(i hope i did fixed it and not missed up), but the current problem with it, is at the line
`function SWEP:PrimaryAttack()`
`if (CLIENT) then return end`
if i put end at the function SWEP, it says "global self nil value" error, but if i DONT put end in there, it requires me to put the end in it. is there any way to fix it? or i just putted wrong, useless function in it?
P.S. if someone is willing to help me, there is the full code, so you can say if it function being useless in it, or it requires another function to work properly
SWEP.HitDistance = 49
function SWEP:Initialize()
self:SetWeaponHoldType( "melee2" )
end
function SWEP:PrimaryAttack()
if (CLIENT) then return end
local ply = self:GetOwner()
ply:LagCompensation(true)
local shootpos = ply:GetShootPos()
local endshootpos = shootpos + ply:GetAimVector() * 75
local tmin = Vector( 1, 1, 1 ) * -10
local tmax = Vector( 1, 1, 1 ) * 10
local tr = util.TraceHull( {
start = shootpos,
endpos = endshootpos,
filter = ply,
mask = MASK_SHOT_HULL,
mins = tmin,
maxs = tmax } )
if not IsValid(tr.Entity) then
tr = util.TraceLine ( {
start = shootpos,
endpos = endshootpos,
filter = ply,
mask = MASK_SHOT_HULL } )
end
local ent = tr.Entity
if(IsValid(ent) and (ent:IsPlayer() or ent:IsNPC() ) ) then
self.Weapon:SendWeaponAnim(ACT_VM_HITCENTER)
ply:SetAnimation(PLAYER_ATTACK1)
ply:EmitSound(HitSound)
ent:SetHealth(ent:Health() - 140)
ent:TakeDamage(140, ply, ply)
if(ent:Health() <=0) then
ent:Kill()
ply:SetHealth( math.Clamp(ply:Health() +0, 1, ply:GetMaxHealth() ) )
else
self.Weapon:SendWeaponAnim(ACT_VM_MISSCENTER)
ply:EmitSound(SwingSound)
end
self:SetNextPrimaryFire(CurTime() + self:SequenceDuration() + 0.1)
ply:LagCompensation(false)
end
function SWEP:CanSecondaryAttack()
return false end
https://redd.it/1nm8pl2
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
LuauTorch7: number crunching for Luau
Hey all!
A few days ago I made a post here, wondering if some numpy-like library were available for Luau!
[https://www.reddit.com/r/lua/comments/1nbw374/numpy\for_luau/](https://www.reddit.com/r/lua/comments/1nbw374/numpyforluau/)
Turns out PyTorch was simply Torch before, used with Lua. It has everything I need, arithmetic, filtering of big tensors, CPU vector extension support.
I tweaked the code to be able to function with Luau, and finally I am satisfied with the results. I added coherent noise generation, based on the FastNoise2 library. Documented everything I removed/modified/added!
With this setup I can generate and filter 5244100 values in just \~0.12 seconds on my old FX-4170! Perfect for user-extendable, lua-based world generation! A real number crunching luau lib to fit my needs!
https://github.com/mihaly-sisak/luau\_torch7
Check out the lib, feel free to provide feedback!
https://redd.it/1nm895a
@r_lua
Hey all!
A few days ago I made a post here, wondering if some numpy-like library were available for Luau!
[https://www.reddit.com/r/lua/comments/1nbw374/numpy\for_luau/](https://www.reddit.com/r/lua/comments/1nbw374/numpyforluau/)
Turns out PyTorch was simply Torch before, used with Lua. It has everything I need, arithmetic, filtering of big tensors, CPU vector extension support.
I tweaked the code to be able to function with Luau, and finally I am satisfied with the results. I added coherent noise generation, based on the FastNoise2 library. Documented everything I removed/modified/added!
With this setup I can generate and filter 5244100 values in just \~0.12 seconds on my old FX-4170! Perfect for user-extendable, lua-based world generation! A real number crunching luau lib to fit my needs!
https://github.com/mihaly-sisak/luau\_torch7
Check out the lib, feel free to provide feedback!
https://redd.it/1nm895a
@r_lua
Reddit
From the lua community on Reddit: Numpy for luau?
Explore this post and more from the lua community
Is the Programming in Lua, fourth edition e-book not available to libraries?
I have started reading the first edition of Programming in Lua and quite like it. I understand the language has changed at least somewhat since it was written and that the fourth edition has a changed (improved?) layout. I wanted to take a look but I can't find it in the digital catalog of any of my libraries.
Hence the noscript question: Is the Programming in Lua, fourth edition e-book not available to libraries?
https://redd.it/1nmbgfv
@r_lua
I have started reading the first edition of Programming in Lua and quite like it. I understand the language has changed at least somewhat since it was written and that the fourth edition has a changed (improved?) layout. I wanted to take a look but I can't find it in the digital catalog of any of my libraries.
Hence the noscript question: Is the Programming in Lua, fourth edition e-book not available to libraries?
https://redd.it/1nmbgfv
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Apps to Learn Lua
Hey my 11 year old cousin is getting into Roblox Development and she wants to learn Lua she is not looking for apps to run Lua but to actually learn it apps like Sololearn
Any help is appreciated thank you!
https://redd.it/1nmx9ms
@r_lua
Hey my 11 year old cousin is getting into Roblox Development and she wants to learn Lua she is not looking for apps to run Lua but to actually learn it apps like Sololearn
Any help is appreciated thank you!
https://redd.it/1nmx9ms
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
moonbeam - a tool for converting single Lua noscripts into standalone executables
https://github.com/htogta/moonbeam
https://redd.it/1nnaabs
@r_lua
https://github.com/htogta/moonbeam
https://redd.it/1nnaabs
@r_lua
GitHub
GitHub - htogta/moonbeam: A silly way of compiling a lua noscript into a single executable
A silly way of compiling a lua noscript into a single executable - htogta/moonbeam
How to add type annotations to compiled C module
My lua module is implemented entirely in C. It is not quite yet ready for prime time, but it is close enough to start thinking about how to make it nice.
One of the things I want is luaCats type annotations. But I cant figure out how to add them to my compiled module?
In my rockspec I have these build instructions, which tell it to use my makefile, and set up passthru for the variables I will need as specified by their documentation. The build and main install step work, which require LUA\_INCDIR in build and LIBDIR in install
build = {
type = "make",
build_variables = {
LUA_INCDIR="$(LUA_INCDIR)",
},
install_variables = {
LIBDIR="$(LIBDIR)",
LUADIR="$(LUADIR)",
},
}
And in the makefile in my install step I do
install: $(SRC)/meta.lua
ifdef LIBDIR
$(check_so_was_built)
@mkdir -p "$(LIBDIR)";
cp "$(DESTDIR)/$(MYMODNAME).so" "$(LIBDIR)/";
@echo "Installed to $(LIBDIR)";
ifdef LUADIR
@mkdir -p "$(LUADIR)/$(MYMODNAME)";
cp "$(SRC)/meta.lua" "$(LUADIR)/$(MYMODNAME)/";
endif
else
@echo "LIBDIR not set, skipping install"
endif
The types in my meta.lua are correct enough and work when I am inside the project directory
However when I install my package via luarocks, usually my editor can find the types for the modules I installed. But for this one it cannot find the types declared in my meta.lua file if I try to declare them manually, nor does it associate `tomlua/meta.lua` with `require('tomlua')` as I thought it was meant to? It does seem to successfully get the meta.lua file to where I expect it to go to, but it isnt being picked up by the lsp.
https://redd.it/1nnpgz8
@r_lua
My lua module is implemented entirely in C. It is not quite yet ready for prime time, but it is close enough to start thinking about how to make it nice.
One of the things I want is luaCats type annotations. But I cant figure out how to add them to my compiled module?
In my rockspec I have these build instructions, which tell it to use my makefile, and set up passthru for the variables I will need as specified by their documentation. The build and main install step work, which require LUA\_INCDIR in build and LIBDIR in install
build = {
type = "make",
build_variables = {
LUA_INCDIR="$(LUA_INCDIR)",
},
install_variables = {
LIBDIR="$(LIBDIR)",
LUADIR="$(LUADIR)",
},
}
And in the makefile in my install step I do
install: $(SRC)/meta.lua
ifdef LIBDIR
$(check_so_was_built)
@mkdir -p "$(LIBDIR)";
cp "$(DESTDIR)/$(MYMODNAME).so" "$(LIBDIR)/";
@echo "Installed to $(LIBDIR)";
ifdef LUADIR
@mkdir -p "$(LUADIR)/$(MYMODNAME)";
cp "$(SRC)/meta.lua" "$(LUADIR)/$(MYMODNAME)/";
endif
else
@echo "LIBDIR not set, skipping install"
endif
The types in my meta.lua are correct enough and work when I am inside the project directory
However when I install my package via luarocks, usually my editor can find the types for the modules I installed. But for this one it cannot find the types declared in my meta.lua file if I try to declare them manually, nor does it associate `tomlua/meta.lua` with `require('tomlua')` as I thought it was meant to? It does seem to successfully get the meta.lua file to where I expect it to go to, but it isnt being picked up by the lsp.
https://redd.it/1nnpgz8
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Lua Scripter
I'm working on a Roblox game and need a Lua Scripter to build a mission system. Where can I find Lua Scripters?
https://redd.it/1np12ai
@r_lua
I'm working on a Roblox game and need a Lua Scripter to build a mission system. Where can I find Lua Scripters?
https://redd.it/1np12ai
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
my nvim lsp is not working
return {
{
"mason-org/mason.nvim",
config = function()
require("mason").setup()
end,
},
{
"mason-org/mason-lspconfig.nvim",
config = function()
require("mason-lspconfig").setup({
ensure_installed = { "lua_ls" },
})
end,
},
{
"neovim/nvim-lspconfig",
config = function()
local capabilities = require("cmp_nvim_lsp").default_capabilities()
vim.lsp.config("lua_ls", {
capabilities = capabilities,
})
vim.lsp.enable("lua_ls")
vim.keymap.set("n", "K", vim.lsp.buf.hover, {})
vim.keymap.set("n", "<leader>gd", vim.lsp.buf.definition, {})
vim.keymap.set("n", "<leader>gr", vim.lsp.buf.references, {})
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, {})
end,
},
}
https://redd.it/1np8pl9
@r_lua
return {
{
"mason-org/mason.nvim",
config = function()
require("mason").setup()
end,
},
{
"mason-org/mason-lspconfig.nvim",
config = function()
require("mason-lspconfig").setup({
ensure_installed = { "lua_ls" },
})
end,
},
{
"neovim/nvim-lspconfig",
config = function()
local capabilities = require("cmp_nvim_lsp").default_capabilities()
vim.lsp.config("lua_ls", {
capabilities = capabilities,
})
vim.lsp.enable("lua_ls")
vim.keymap.set("n", "K", vim.lsp.buf.hover, {})
vim.keymap.set("n", "<leader>gd", vim.lsp.buf.definition, {})
vim.keymap.set("n", "<leader>gr", vim.lsp.buf.references, {})
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, {})
end,
},
}
https://redd.it/1np8pl9
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
I need to deobfuscate a code
https://raw.githubusercontent.com/nouralddin-abdullah/99-night/refs/heads/main/main-en.lua
I found this in my school group chat and idfk what is this
https://redd.it/1nphyt8
@r_lua
https://raw.githubusercontent.com/nouralddin-abdullah/99-night/refs/heads/main/main-en.lua
I found this in my school group chat and idfk what is this
https://redd.it/1nphyt8
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Looking for a Developer / Reverse Engineer
Looking for a Developer / Reverse Engineer
I’m seeking someone with strong experience in C# and LuaJIT (including working with runtime dumps and decompiled bytecode). The task involves analyzing and reversing some files, so familiarity with reverse engineering practices is important.
If you have the expertise and are interested, please reach out to discuss details.
https://redd.it/1nprqz7
@r_lua
Looking for a Developer / Reverse Engineer
I’m seeking someone with strong experience in C# and LuaJIT (including working with runtime dumps and decompiled bytecode). The task involves analyzing and reversing some files, so familiarity with reverse engineering practices is important.
If you have the expertise and are interested, please reach out to discuss details.
https://redd.it/1nprqz7
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Is it a good idea to use Lua (with JIT) in some serious applications?
I heard it has simplicity of Python combined with the speed of C-languages. I asked ChatGPT about it and it said they never use it just because people never do.
So, maybe I will be an exception? Because I like metatables and the Lua syntax itself
https://redd.it/1nq3iwf
@r_lua
I heard it has simplicity of Python combined with the speed of C-languages. I asked ChatGPT about it and it said they never use it just because people never do.
So, maybe I will be an exception? Because I like metatables and the Lua syntax itself
https://redd.it/1nq3iwf
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
I've done something with the lua API
I've been learning about Lua, especially how it works, and I understand the stack method it uses to store things. Well, that's more or less what I understood from its documentation. Playing around with the API, I created something with SDL Mixer. It's basic for playing audio files, so I'm just learning. I'd like your feedback and recommendations. Feel free to contribute if you'd like. To the code. https://github.com/JuanPerdomo00/Laudio
https://redd.it/1nqhxdn
@r_lua
I've been learning about Lua, especially how it works, and I understand the stack method it uses to store things. Well, that's more or less what I understood from its documentation. Playing around with the API, I created something with SDL Mixer. It's basic for playing audio files, so I'm just learning. I'd like your feedback and recommendations. Feel free to contribute if you'd like. To the code. https://github.com/JuanPerdomo00/Laudio
https://redd.it/1nqhxdn
@r_lua
GitHub
GitHub - JuanPerdomo00/Laudio: Simple lib audio lua
Simple lib audio lua. Contribute to JuanPerdomo00/Laudio development by creating an account on GitHub.
blackscreen NUI fix.
FIVEM if you ever built a UI and are bashing your head against the wall with a backscreen that just wont go away here is the fix. Root cause: CEF (the Chromium wrapper FiveM uses) was compositing a fallback opaque layer behind your UI. If the page/body/background aren’t explicitly transparent, or if you use CSS effects that force a new compositing layer (backdrop-filter, heavy box-shadow, large border radii), CEF often draws a solid black rounded rectangle as the fallback.
What the fixes did:
Explicitly set body/html background to transparent so CEF knows to render game beneath the page.
Removed backdrop-filter and reduced/removed the heavy box-shadow so the browser didn’t create the extra opaque compositing layer.a
Used a semi‑transparent RGBA card color instead of relying on filters; that avoids forcing the opaque fallback.
Practical note: If artifacts persist after code changes, clear FiveM cache and restart the client because CEF can cache rendered frames.
https://redd.it/1nr9glu
@r_lua
FIVEM if you ever built a UI and are bashing your head against the wall with a backscreen that just wont go away here is the fix. Root cause: CEF (the Chromium wrapper FiveM uses) was compositing a fallback opaque layer behind your UI. If the page/body/background aren’t explicitly transparent, or if you use CSS effects that force a new compositing layer (backdrop-filter, heavy box-shadow, large border radii), CEF often draws a solid black rounded rectangle as the fallback.
What the fixes did:
Explicitly set body/html background to transparent so CEF knows to render game beneath the page.
Removed backdrop-filter and reduced/removed the heavy box-shadow so the browser didn’t create the extra opaque compositing layer.a
Used a semi‑transparent RGBA card color instead of relying on filters; that avoids forcing the opaque fallback.
Practical note: If artifacts persist after code changes, clear FiveM cache and restart the client because CEF can cache rendered frames.
https://redd.it/1nr9glu
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
love2D
I want to make a simple game with love2D, but I don't know how to use it, where can I find documentation for it?
https://redd.it/1nrjjru
@r_lua
I want to make a simple game with love2D, but I don't know how to use it, where can I find documentation for it?
https://redd.it/1nrjjru
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
What do you think about OOP in Lua?
Hi guys, I recently started to learning Lua, and pretty fast I learn almost everything, but only metatables, the most powerful Lua thing, left (and coroutines btw, but that's not the topic). And, using some meta-functions, you can basically create everything. Also I saw an example when you can create any object of type Person, and setup its parameters, like name, age etc. I don't understand yet what it actually doing to reach this, so I want to ask you: is OOP in Lua that comfortable like, for example, in C++ or Java?
https://redd.it/1nrnfro
@r_lua
Hi guys, I recently started to learning Lua, and pretty fast I learn almost everything, but only metatables, the most powerful Lua thing, left (and coroutines btw, but that's not the topic). And, using some meta-functions, you can basically create everything. Also I saw an example when you can create any object of type Person, and setup its parameters, like name, age etc. I don't understand yet what it actually doing to reach this, so I want to ask you: is OOP in Lua that comfortable like, for example, in C++ or Java?
https://redd.it/1nrnfro
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community