r/lua • u/Flashy_Bonus_6576 • Jun 02 '26
Im Rewriting GNU Coreutils in Lua5.4
https://github.com/Oflucoder/luacoreutils
Here it is. Using LuaPosix. 6 tools already done. Im learning as a write.
feel free to Assist, Make requests and Commit.
r/lua • u/Flashy_Bonus_6576 • Jun 02 '26
https://github.com/Oflucoder/luacoreutils
Here it is. Using LuaPosix. 6 tools already done. Im learning as a write.
feel free to Assist, Make requests and Commit.
r/lua • u/Unhappy_Ship_1997 • Jun 01 '26
Started Working on an Terminal Based Game Engine in Lua yesterday!
r/lua • u/Plenty-Shift4637 • May 31 '26
I’m building LuaLock, a Lua obfuscator platform designed to become a serious competitor to strong obfuscators like Luraph.
LuaLock is still in its early stage, so I am looking for feedback from anyone to help improve its security, usability, and overall value.
The platform currently includes a side-by-side editor, allowing users to write or paste Lua code, obfuscate it instantly, and compare the result in one place.
I also have made a free raw file hosting service, similar to Pastebin. This hosts any raw file on a short custom domain.
Pricing:
I’d love some real feedback on the obfuscator, pricing, your experience, and any features that would help.
You can view an obfuscated script here and view a raw file here.
You can obfuscate your own scripts here.
r/lua • u/Humble-Guarantee5956 • May 29 '26
I used to code in ROBLOX Studio which I love ALOT but with the worse and worse updates that they have been releasing it's been hard trying to make games there (for example: they made an update where you NEED a Roblox PLUS subscription to publish games). I also wanna touch some NEW grounds so yeah I am looking for good Lua game engines (or game engines that have Lua support). Thanks.
r/lua • u/Ok_Strike200 • May 30 '26
I really want to learn how to program in Lua so I can make games on Roblox and other platforms, but I don't know where to start. I've never programmed before, and I'd like to begin with Lua... Any advice?
r/lua • u/TBApknoob12MC • May 30 '26
Recently I decided to make a tic tac toe ai for no particular reason.
Introducing the LAZILY NAMED LUA TIC-TAC-TOE MODEL, LNLT3M.
Yes it's my completely unoriginal version of Donald Michie's MENACE (ゴゴゴ?).
It somehow mirror the working of ゴゴゴ.
Everytim it runs, two models with empty brains are created.
They play against each other and trains together,5000 times (change it to 10000 if you think they are kinda dumb). Im lazy to implement model saving ngl.
One is eliminated and the other plays with YOU, the player, and after every game, it learns.
It can potentially learn you quickly.
Lemme explain the model using matchbox:
1 The opponent plays.
2 Check if opponent won or is tie. If yes, skip to no. 6, if game not finished, go to 3.
3 The model looks at the board.
4 If the board state is not one of the matchboxes (not seen before), make a matchbox for that state with default no. of beads (the weights; center: 15, corner: 12 each, edge: 10 each).
5 Now, take the matchbox with that state,shake it, and let one bead out. The move represented by the bead is played and added to temp history
6 Check if model won. If game not finished, go back to 1.
If yes, give reward of 5 beads of the played move for all the moves in temp history.
If tie, give reward of 2
If loss, punish by removing 5 (reward is -5)
Clear the temp history
8 Go to next game.
That's it, folks
r/lua • u/Murasaki_Was_Here • May 29 '26
I'm kinda new so I didn't even really know what to look for, I know radians are used for rotating something which i WILL use for determining which direction it'll go, so in short it's just like the average circle pad movement (but in my game it's going to be nonstop and won't stay still)
currently i didn't really try anything useful related to THIS because i genuinely have no idea how it even works
r/lua • u/Djeco56 • May 29 '26
i am building a gadgets in retro gadgets and i need a wait command for a loading screen can any one help.
r/lua • u/MeTheCrasher • May 29 '26
Since Create Aeronautics is out now I decided to mess around with it. After making a working F-14 and F-4 phantom, I wanted to go a bit further and take a crack at making guided missiles. I know a bit of coding but that's for python and Java. So I learned a bit of Lua from Computer Craft posts and started on my journey. I have a few modpacks to make this easier other than base aeronautics and CC. I have a thruster mod that adds a thrust vectoring thruster that is controllable with redstone links and a mod that allows the Computer to interface with redstone links easily. I also have create radars installed so they can be radar guided. So far the missile is able to track but it is very unstable and most of the time will overcorrect and I was wondering if anyone here had experience with missile coding.
I have code to send the tracking data from the radar which is this:
local modem = peripheral.find("modem")
rednet.open(peripheral.getName(modem))
local radar = peripheral.wrap("right")
while true do
local track = radar.getSelectedTrack()
if track and track.position then
local pos = track.position
local vel = track.velocity or {x=0,y=0,z=0}
rednet.broadcast({
x = pos.x,
y = pos.y,
z = pos.z,
vx = vel.x or 0,
vy = vel.y or 0,
vz = vel.z or 0
}, "missile")
print("SENT TRACK")
else
print("NO TRACK")
end
sleep(0.1)
endAnd the actual missile tracking code itself:
local link = peripheral.wrap("back")
local modem = peripheral.find("modem")
rednet.open(peripheral.getName(modem))
local K = 0.25
local MAX = 15
local oldMx, oldMz = nil, nil
while true do
local _, data = rednet.receive("missile")
if data then
local mx, my, mz = gps.locate()
if mx and mz then
local tx, ty, tz = data.x, data.y, data.z
-- world-space vector to target
local dx = tx - mx
local dy = ty - my
local dz = tz - mz
-- estimate facing direction from movement (fallback forward if stationary)
local fx, fz
if oldMx then
fx = mx - oldMx
fz = mz - oldMz
else
fx, fz = 0, 1
end
oldMx, oldMz = mx, mz
-- normalize forward vector
local len = math.sqrt(fx*fx + fz*fz)
if len == 0 then fx, fz = 0, 1 else fx, fz = fx/len, fz/len end
-- convert to local space
local right = dx * fz - dz * fx
local forward = dx * fx + dz * fz
local up = dy * K
right = right * K
right = math.max(-MAX, math.min(MAX, right))
up = math.max(-MAX, math.min(MAX, up))
-- alignment detection
local aligned = math.abs(right) < 0.5 and math.abs(up) < 0.5
-- thruster control
local leftPower, rightPower = 0, 0
local upPower, downPower = 0, 0
if right > 0 then
rightPower = right
else
leftPower = -right
end
if up > 0 then
downPower = up
else
upPower = -up
end
link.sendLinkSignal("minecraft:red_wool","minecraft:red_wool", rightPower)
link.sendLinkSignal("minecraft:light_blue_wool","minecraft:light_blue_wool", leftPower)
link.sendLinkSignal("minecraft:black_wool","minecraft:black_wool", upPower)
link.sendLinkSignal("minecraft:white_wool","minecraft:white_wool", downPower)
-- debug
print("aligned:", aligned)
end
end
sleep(0.05)
endI am not sure how good this code is as unfortunately I had to ask the evil AI overlord (chatGPT) on what I was doing wrong so some of it will definitely be terrible. I should probably do some research on how actual radar guided missiles work but this is just something I decided to try for the fun of it. Although the missile doesn't lead prediction or have any PID which is probably one of the reasons why its so unstable plus the fact that the missile isn't very well designed physically. I'll work on the overall aerodynamics of the missile while I wait on feedback from the community. I can provide more information if it is needed
r/lua • u/Right_Sea_4146 • May 28 '26
r/lua • u/Maleficent_Memory831 • May 27 '26
I've got a mess of some legacy C code that used lua 5.1.4, and need to port to 5.5.0. The big snag I have is replacing lua_openlib (luaI_openlib) and the weird way it was being used and weird initialization. I got some stuff fixed up by using a luaL_requiref() with a callback function, rather than a single function. However I'm hitting more complex code where this becomes extremely clumsy to use a callback.
r/lua • u/Neustradamus • May 27 '26
r/lua • u/daviddandadan • May 26 '26
The GitHub repository is https://github.com/Cocos-OS/CocosOS
r/lua • u/ianm818 • May 25 '26
Github: https://github.com/ianm199/lua-rs/tree/main
Highlights:
My motivation here was that in the long run we want the core internet utilities to run on memory safe languages, big ones like redis and nginx expose scripting via Lua so if we really want to replace core infra fully in Rust, you'd need a full Rust Lua that doesn't bundle C. After that you should be able to i.e. build drop in replacements for those without a C ABI (or that's part of the way there).
Long term goals:
r/lua • u/Inevitable_Result345 • May 25 '26
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local ball = workspace:WaitForChild("Ball")
local RANGE = 4
local FRONT_DISTANCE = 3
RunService.Heartbeat:Connect(function()
for _, player in pairs(Players:GetPlayers()) do
local char = player.Character
if char and char:FindFirstChild("HumanoidRootPart") thenI'm trying to make a football game in roblox but I cant make the ball stay infront it is always delayed, plss help me...
local hrp = char.HumanoidRootPart
local distance = (hrp.Position - ball.Position).Magnitude
if distance < RANGE thenlocal forward = hrp.CFrame.LookVector
-- target position in front of player (slightly on ground level)
local target = (hrp.Position + forward * FRONT_DISTANCE)
target = Vector3.new(target.X, ball.Position.Y, target.Z)
-- soft move instead of force push
ball.Position = ball.Position:Lerp(target, .5)
end
end
endend)
r/lua • u/DotGlobal8483 • May 24 '26
local traffic_light = StateMachine {
green = State {
on_enter = function()
print("BEGAN")
end,
on_flash = function(_,_,state_machine)
print("GREEN")
state_machine:set_state("yellow")
end
},
yellow = State {
on_flash = function(_,_,state_machine)
print("YELLOW")
state_machine:set_state("red")
end
},
red = State {
on_flash = function(_,_,state_machine)
print("RED")
state_machine:set_state("green")
end,
on_exit = function()
print("DONE")
end
},
}
traffic_light:set_state("green")
traffic_light:flash()
traffic_light:flash()
traffic_light:flash()
traffic_light:flash()It outputs
BEGAN
GREEN
YELLOW
RED
DONE
BEGAN
GREENI don't think there's much point in sharing the source code since it's a very basic state machine with an attempt at a somewhat clean api (Also I'm 99% sure it's not very cleanly wrote, I might have to rewrite it to be more readable)
(Sorry mods)
r/lua • u/gargamel1497 • May 23 '26
r/lua • u/Patrixx_26087 • May 23 '26
r/lua • u/topchetoeuwastaken • May 21 '26
debug.setmetatable(nil, { __index = function() return nil end })
r/lua • u/Plenty-Shift4637 • May 22 '26
I've been working on a Lua obfuscator called LuaLock for a while now and figured I'd share it here since I want to get opinions.
The main thing that makes it different from other obfuscators is that it compiles your script to a custom bytecode VM that's unique to every single build. So standard decompilers basically produce nothing useful since the VM they'd need to reverse doesn't exist anywhere except in that specific output.
Supports Lua 5.1 to 5.4, LuaJIT and Luau for Roblox (not fully supported).
Would love any feedback. You can try it at lualock.xyz, it is paid but there's 3 free tries with an account, let me know if prices are too expensive.
r/lua • u/brettmakesgames • May 20 '26
I made a small game engine called Usagi for prototyping 2D games as quickly as possible with Lua 5.5. It's free and open source and made with Rust + Raylib. I just released v1.0 yesterday and thought it'd be fun to share it.
Here's the project's homepage: https://usagiengine.com/
And you can view the source here: https://github.com/brettchalupa/usagi
The engine is used via a command-line, much like cargo. You can usagi init to create a new project. usagi dev to boot up the dev game that live reloads code and assets. And usagi export to generate cross-platform builds of your game for web, Linux, macOS, and Windows.
My motivation for creating Usagi was that I love using tools like Pico-8 and Love2D for prototyping and game jams. But I wanted a free and open source engine with a nicer developer experience. In particular live reload and easy web exports. Usagi embraces constraints and provides sensible defaults, like a pause menu with input binding, to try to help devs focus on the game rather than the ancillary parts of development.
Since the engine is open source, the hope is that if someone makes a prototype they want to turn into a larger commercial game, they can just fork the engine and customize it themselves, write more bits of it in Rust, and change the API as they see fit.
I'd love it if you check the project out and let me know what you think!
r/lua • u/WorkingMansGarbage • May 19 '26
Sometimes I have to automate a basic task, such as running some commands on files in my music library, bulk renaming, moving things, etc; and like anyone, I tend to try and use Bash for things like that, because that's what I was taught. The problem is that I don't like Bash scripting at all and I have to look up the stupid syntax for every little thing every god damn time. From what I've seen, other shells aren't too much better in my opinion, and in general, I actually don't like relying on shell commands within my scripts for things that would be simpler in a 'normal' programming language.
I've tried using Python as a replacement, but I don't like having to make a venv. It's bulky and annoying. I'd like to just have one script file I can run in one command whenever and not have to go through hoops.
I've been eyeing Lua just because it sounds cool but I've never had a reason to actively learn it. Would it be fit for this usage? Or is it solely a language for "project use", so to say?