r/learnprogramming • u/GodOfKnockers • 1d ago
Wanting to learn LUA Script
So I'm modding games and I am making a mod for Balatro, which uses LUA. I tried to look for books at the library but all I could find was modding bocks for Roblox (NO TO THAT).
Can anyone point me in the right direction, please?
2
u/Simpicity 1d ago
If you want to learn Lua, Roblox is a very good way to go. It's not like you have to publish anything.
1
u/stylish_rufus 1d ago
just start making the mod. you’ll pick up lua as you go, that’s how most folks do it. the balatro modding discord probably has snippets and examples you can tear apart to see how stuff works.
2
u/toxic_prince21 1d ago
Balatro runs on LÖVE, which uses LuaJIT. That’s basically Lua 5.1, so learn that version.
- Programming in Lua (the first edition is free at lua.org/pil) is the classic book.
- weblua.com lets you run Lua in your browser with no install. (I made Weblua) Set it to Lua 5.1 and play around.
- Balatro’s .exe can be opened with 7-Zip, so you can read the game’s code. After that, check out Steamodded and its Discord.
Learn tables first. They’re Lua’s only data structure, so lists, records and modules are all tables.
2
1
u/Cootshk 1d ago
Balatro is written in Love2D, go check their wiki, it has some great resources
Also, https://learnxinyminutes.com/lua if you already know a different programming language
1
1
u/B0mbon 1d ago
Honestly the best book is still Programming in Lua by Roberto Ierusalimschy, he's one of the people who made the language, and an older edition is fine for modding. But since you're brand new I'd learn just enough basics (variables, tables, functions, if/for) and then open an existing small Balatro mod and read it line by line. Modding is mostly reading other people's code and changing one thing at a time, so pick a tiny mod like a single joker and try to tweak what it does. Tables are the big Lua thing, once those click most mod code starts making sense.
1
u/Blissextus 1d ago
You can either learn LUA via:
- Lean Lua directly from the Official LUA website
- Learn Lua from Love2D - this is the API that Balatro uses. (Lua 5.1 using LuaJIT)
- Lean Lua from Defold Game Engine - this is what I used to learn Lua. (Lua 5.1 using LuaJIT)
1
u/symmetricon 1d ago
https://www.lua.org/manual/5.5/manual.html
This is the documentation provided by lua. Start with the introduction. Create a lua file, learn how to run it from the command line. In the file, try each thing you learn from then docs and print out the results
1
u/rokon_pt 3h ago
There is cs50 2d - I haven't done it, I'm not sure if it fits what you are looking for, but it would probably be my first option of wanting to learn Lua and love.
2
u/abrahamguo 1d ago
Have you taken a look at the "Getting started" section of the official Lua website?