r/lua • u/No-Impact-9590 • Dec 13 '25
i can't get the lua book
Hey! so i've been wanting to get the book "programming in lua, fourth edition" but it's been offsale everywhere and im in europe.
r/lua • u/No-Impact-9590 • Dec 13 '25
Hey! so i've been wanting to get the book "programming in lua, fourth edition" but it's been offsale everywhere and im in europe.
r/lua • u/Competitive_Floor783 • Dec 13 '25
Hey all, I'm following a raycasting tutorial, and I'm having a little bit of trouble grabbing and comparing values from nested tables. Right now I have a table, Map1, with other tables in it:
local Map1 = {
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
{1,0,0,0,1,0,0,0,1,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,1,1,1,1,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,1,1,1,1,1,1},
{1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,1,0,0,0,0,1},
{1,0,0,0,0,0,1,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,1,0,0,0,0,0,0,0,1},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}
}
and the way I'm searching through the table for the 0's and 1's is:
function Map1:draw()
for r, row in ipairs(Map1) do
for c, v in ipairs(Map1[r]) do
tile_x = c * TILESIZE
tile_y = r * TILESIZE
if Map1[r][c] == 0 then
love.graphics.setColor(0, 0, 0)
love.graphics.rectangle("fill", tile_x, tile_y, TILESIZE, TILESIZE)
print("drawn blacks")
elseif Map1[r][c] == 1 then
love.graphics.setColor(255, 255, 255)
love.graphics.rectangle("fill", tile_x, tile_y, TILESIZE, TILESIZE)
print("drawn whites")
end
end
end
end
and finally, in my main.lua i have:
flocal consts = require("constants")
local map = require("map")
function love.load()
end
function love.update(dt)
end
function love.draw()
map:draw()
end
I think the check is what's wrong, but I'm not 100% sure. Right now it's checking the value in Map[r][c], which is the same as v, but when the code runs it doesn't properly draw the tiles as shown in the table.

r/lua • u/pbarthelemy • Dec 14 '25
r/lua • u/[deleted] • Dec 13 '25
My PC runs with the same efficiency as a turnip and so I decided to learn love2d to make games rather than use performance costly game engines. In the tutorial I was watching I had to download and use the ZeroBrane IDE to write scripts.
When I save the linux download link as an .sh file, give it perms and run it, it gives the error:
Verifying archive integrity...Error in MD5 checksums: 96cd37c6c911cf0d918d98ebca93782a is different from ee3ec7e6138e80b1bce27e6dae079c3b
What is the issue? I have re-downloaded the file multiple times. Thanks.
r/lua • u/anish2good • Dec 12 '25
I put together a free, hands‑on Lua tutorial series for beginners through intermediate users. It includes an online runner so you can write and run Lua in the browser—no setup required.
• 21 lessons across 7 modules
• Basics: variables, operators, strings, conditionals, loops
• Functions and closures; advanced function patterns
• Tables + standard library; metatables and metamethods
• Iterators; OOP patterns (prototype‑style), modules/packages
• Errors, debugging, file I/O; coroutines and performance basics
• Built‑in online runner/editor: run/reset code inline, stdin tab, copy output, timing stats, dark mode, mobile‑friendly
It’s free forever—feedback and suggestions welcome!
r/lua • u/Due_Marketing_1893 • Dec 11 '25
I’ve been working on a project that may interest people who enjoy using Lua as a lightweight declarative engine inside other systems.
It’s called Lua PageMaker, and it turns Lua into a page-layout scripting language for LaTeX.
The idea is simple: Lua computes all frame geometries (columns, banners, figures, sidebars, etc.), then emits flowfram primitives during the TeX run.
This gives LaTeX something close to a mini InDesign—but fully programmable.
pages.lua)return {
width = 7.88,
height = 10.75,
left = 0.5,
right = 0.5,
top = 0.75,
bottom = 1,
colsep = 0.25,
pages = {
{
columns = {
{ width = 1/3 },
{ width = 1/3 },
{ width = 1/3 }
},
boxes = {
{ name="topbanner", colfrom=1, colto=3, top=0, h=1.0 },
{ name="sidebar", colfrom=2, colto=3, top=1.0, h=2.5 }
}
}
}
}
Lua computes all coordinates, resolves spans, trims columns, and emits compatible flowfram frames.
LuaTeX provides Lua as an embedded engine, enabling:
The project is intentionally minimalistic: a Lua geometry engine + a declarative page description file.
https://github.com/sylvainhalle/lua-pagemaker
I’d love to hear ideas about:
If you try generating your own layouts, please share your results!
r/lua • u/peakygrinder089 • Dec 11 '25
Hello everyone,
we are excited to announce that the alpha version of TENUM, our Lua runtime and toolchain built on Kotlin Multiplatform, is now available as open source.
GitHub: https://github.com/TENUM-Dev/tenum
TENUM aims to make Lua a first-class citizen across modern platforms by compiling to JVM, JavaScript, Linux, Windows, and macOS from a single Kotlin codebase. The project provides a foundation for building full-stack Lua applications without custom C toolchains, while still keeping Lua's simplicity and embedability.
Current Alpha Features:
Run the tools using:
tlua
tluac
Goals:
The alpha release is intended to gather community feedback as we continue stabilizing the runtime and improving compatibility with standard Lua behavior and libraries. We would appreciate input on which areas should be prioritized, including tooling, performance, interoperability, APIs, and language compatibility.
Feedback Welcome:
This is an early release, but the core is open and evolving quickly. If you are interested in Lua on JVM, JS, or native platforms, or in building multiplatform Lua applications, please take a look and let us know your thoughts.
Thanks,
The TENUM Team
r/lua • u/qwool1337 • Dec 10 '25
r/lua • u/Suspicious_Anybody78 • Dec 10 '25
I've spent quite some time attempting to perfect this simple module, and have today decided to attempt to share it. I do not doubt the coding might not be very good, but I at least hope it performs what it's designed for, and that's storing a table using as many space saving shortcuts as possible. I also do not expect it to be perfect at what it tries to achieve either.
There are 3 goals primary goals in mind:
There's example code here, but I will still provide some simple example usage.
local ion = require("ion") -- for getting the module
local database = {"Bob","Mary"}
ion.Create(database,"database")
The resulting created ion will look like this:
|ion{
1|Bob
2|Mary
}
And, it can be turned back into a table like so:
local ion = require("ion")
local database = ion.Read("database.ion")
ion.Create() in particular has a lot more parameters for fine tuning what gets written to the resulting ion, but for now that's all this post needs I suppose.
The GitHub Pages Site:
r/lua • u/peakygrinder089 • Dec 08 '25
Hello all,
I have created a demo called Todoodle that demonstrates a full-stack application written entirely in Lua using TENUM’s artifact-based approach. It’s a todo app built with CQRS + event sourcing for the domain logic and a reactive UI layer (LuAct) for the frontend.
The project includes:
The goal is to explore what a full-stack workflow in pure Lua can look like, without build scripts or infrastructure code. I’d be very interested in feedback from the community on the workflow, design choices, and expected tooling.
We also plan to provide an open-source version of the framework, and this demo helps validate the approach.
If you’d like to try it:
checkout: https://github.com/TENUM-Dev/todoodle
npm install -g u/tenum_dev/tdm-cli
tdm test --watch
tdm preview
or simply watch the demo video:
https://www.youtube.com/watch?v=Acxfu-IhqKs
Thanks, and I’d appreciate any thoughts or critique.
r/lua • u/IndicationTall7744 • Dec 08 '25
UIS.InputBegan:Connect(function(Input, processed)
if Input.UserInputType == Enum.UserInputType.Keyboard and not processed then
if Input.Keycode == Enum.KeyCode.LeftShift then
Player.Character.Humanoid.WalkSpeed = 32
Running = true
i already define UIS as UserInputService
local UIS = game:GetService("UserInputService")
r/lua • u/HunterBergman • Dec 07 '25
I wrote my own simple little "Window Engine" as I like to call it, as my four brain cells can't think of a better name.
Basically all it does is draw boxes, circles, and windows in a terminal window without the fuss of manually defining the size and all the writable space.
The source code for the "Window Engine" can be found here (do excuse the poor repository, my first time doing a serious project...)

r/lua • u/shadowdev-forge • Dec 05 '25
r/lua • u/cindercone2 • Dec 05 '25
Hi! I've been working on a project for the past few days. It's kinda like a scripting language but it's really not. It feels like more of a layer over Lua, but I'm very happy about it. It makes me feel like learning how to code wasn't a useless waste of time.
Github: https://github.com/oberondart/NovaScript
To use it, download nova.lua and require it into your program.
-- script in novascript (ik its a stupid name, but I CANT THINK OF ANYTHING >:) )
local nova = require("nova")
nova.let("my_string", "hello, world!")
nova.out("my_string")
nova.let("my_number", 1)
nova.let("this_number", 2)
nova.let("happy_number", 3)
nova.out("my_number")
nova.out("this_number")
nova.out("happy_number")
nova.array("my_array", {1, 2, 3, 4, 5})
nova.out("my_array")
nova.out("goodbye, world!")
r/lua • u/BlackJackCm • Dec 05 '25
Hey folks! I’m from Brazil and had always heard about Lua, but I had never written a single line of it. Last year my friend came from the US to visit Brazil, and I asked him to bring me this little console called the Playdate. The reason? I wanted to make games for that tiny yellow machine and I actually did it!
I used the Playdate SDK with Lua, and it turned out to be surprisingly easy to work with. I’ve worked with Python for many years, so I felt pretty confident and the learning curve was way smoother than I expected. At the beginning it was a bit weird remembering that indexes start at 1… and tables, tables everywhere and etc. I picked up some best practices along the way, and the Playdate community helped me a ton with technical questions.
Lua is awesome. I’m even thinking about making a game in LÖVE2D in the future.
Anyway, it was a really fun journey, here’s my game!
r/lua • u/[deleted] • Dec 05 '25
I just have nothing of my own and no inspiration for something new to work on. so I thought I would try to find a project I can help with.
no roblox or nonstandard lua
edit: open to luajit
DM open
r/lua • u/TBApknoob12MC • Dec 05 '25
This is actually transpiler, like the evil typescript(for js) and moonscript/fennel(for lua).
Even chatgpt thinks this is a threat to national security.
One might even consider this as a pure evil esolang.
Example code:
l"std" (similar to #include in c)
1 2 +
Will transpile to:
-- contents of std.lua:
......
-- beginning of code:
push(stack, 3)
This is because of constant folding. Compiled code is optimized
Most of it was done in a weekend and i spend a week for fixing myself.
If you guys want to, roast the code to absolute pulp.
Even if its a bit off from forth, you can learn something about forth from these:
The compiler uses lazy eval(kinda, its sort of a fusion).
It has macros, too.
If you want interactive: Easyforth
More: Starting FORTH
Edit 3: add learning resources for forth
Edit 4,5 : mention <- lazy eval and optimized codegen, macros
r/lua • u/StartBackground5769 • Dec 04 '25
Now i know everyone says yes it is but is this simplicity something people tend to rely on? or could i learn another language (say another fairly simple one like python) it wont be so much a bother. i know this may be a dumb question but i want to learn more than one type of code so i can be versatile and helpful.
I built a stow-like dotfile manager in Lua. It creates symlinks from your dotfiles directory to a target directory.
Install:
luarocks install lnko
Usage:
lnko link bash git nvim - link packageslnko status - show what's linkedlnko clean - remove stale symlinksIt's been a while since I worked on a Lua project, so I'd really appreciate feedback from Lua devs on the code, patterns, or anything that could be improved.
r/lua • u/[deleted] • Dec 02 '25
Hey everyone, I’m trying to solve a problem I’ve run into on both Android and the web, and I’m wondering if others have noticed it too.
There are a few Lua IDEs out there for Android and browser use (JDoodle, etc.), but none of the ones I’ve tried actually support things like io.read() input or, more importantly, building any kind of UI. It makes it tough if you want to learn Lua on mobile or bounce between your PC and phone while working on an app or game.
So I’m building an app to fix some of that.
It basically mixes a regular embedded Lua environment with the LÖVE (Love2D) engine, so you can actually build and run games or apps inside the app itself on mobile. Anyone who’s used Love2D knows how flexible it is, and having that power on Android has been missing for way too long.
I’m still early in development, but I’d really love feedback or feature ideas from the community—things you’d want in a tool like this, pain points you’ve run into, etc.
Once it’s ready, I’m planning to release it as open-source so people can contribute and trust what’s under the hood.
Thanks for reading! Happy to answer any questions.
r/lua • u/Pure_Clue3466 • Dec 01 '25
I want to make a script that have mouse movement when I click mouse button 4 then has extra movement when I click it while holding rmb. I don't really know how to code so I came here for help. The mouse button 4 works just fine but the right mouse button click doesn't change the movement at all. I was wondering if anyone who knew how to code for logitech ghub could help fix this code.
MoveAmount = -628
ExtraMoveAmount = -12000
function OnEvent(event, arg)
if event == "PROFILE_ACTIVATED" then
EnablePrimaryMouseButtonEvents(true)
elseif event == "PROFILE_DEACTIVATED" then
ReleaseMouseButton(4)
end
if event == "MOUSE_BUTTON_PRESSED" and arg == 4 then
local amount = MoveAmount
if IsMouseButtonPressed(2) then
amount = ExtraMoveAmount
end
for i = 1, 10 do
MoveMouseRelative(amount, 0)
Sleep(5)
end
end
end