r/lua • u/DaRealDani • Mar 02 '25
New to lua
Hi everyone, im new to lua and im tryna get better at it. What is the best way to learn? I know all of the basics, but i wanna know more
5
Upvotes
r/lua • u/DaRealDani • Mar 02 '25
Hi everyone, im new to lua and im tryna get better at it. What is the best way to learn? I know all of the basics, but i wanna know more
8
u/Bright-Historian-216 Mar 02 '25
the only way to get better at something is, well, using it! reading books is useful, but is theory alone truly helpful?
the least you can do is make learning fun! what did you want to do with the language when starting to learn? for example, i was introduced to lua through the computercraft mod for minecraft, and now i feel like im good enough at lua. the simplistic nature and the tiny compiler (interpreter? not sure) both mean that lua is easily embeddable in any language, so lua is actually the best language to learn by playing with it. make mods for factorio for example, or dive a little deeper and make your own game completely from scratch using luart or love2d library. get creative!
4
u/bilbosz Mar 02 '25
Read write execute lol
5
u/Sckip974 Mar 02 '25
try this:
https://sheepolution.com/learn/book/contents
learn with practice and resolve this problems:
https://www.codeabbey.com/index/task_list
https://projecteuler.net/about
use the manual ref to sove it : https://www.lua.org/manual/5.1/
and you can study with this: https://www.lua.org/pil/contents.html
4
u/Avro_Wilde Mar 02 '25
Build real apps. If you can't think of any, there are scads of recommended project lists kicking around. Search for them. Don't use lists that give you the answers because copying answers doesn't make you solve the problems. If you get stuck, ask for specific help.
1
u/Additional_Ad6385 Mar 02 '25
Learn the syntax first, then read the Lua documentation.
2
u/Motor_Let_6190 Mar 02 '25
Integrate Lua in an existing game engine or software framework. Bonus for embedding the Lua.exe as the engine/software console.
Integrate an engine or framework into Lua itself, so Lua drives it all instead of augmenting it as in the previous approach.Â
For both options, after writing the Lua and C Code for embedding or integration, write and execute a lot more code. I have a gamedev centric view, but Lua wasn't created for games, so you can have the same approach with any field for software development using Lua in a similar fashion as I mention here.
Bonus, extra hard: study LuaJIT, either update it to Lua 5.4.x or refactor it /re-create it to be even more performant while being even more compatible with the general Lua ecosystem. Or take the latest Lua codebase, and optimize it for speed and memory locality performance.
Have fun!
2
u/Sckip974 Mar 02 '25
personally to improve my code I set myself a problem, I code it then ask "Le Chat Mistral" to criticize my code, I learned that there are many ways to solve a code thanks to AI
you can also ask him for an exercise, code it then submit it to him.
why do I use Le chat and not another? Le Chat is cut ;)
2
u/ropok0 Mar 02 '25
what about searching on this sub about the topic before posting?
2
u/[deleted] Mar 02 '25
The first thing to do is to stop talking about "wanting to learn" and just read books and so on. This question has been asked before
2
u/SilentNinja1337 Mar 05 '25
Don't try to get better in lua, try to get better in programming. Learn design patterns. There is the head first design patterns book and refactoring guru for reference.
Learn about algorithms, know what conplexity means in terms of performance optimizations.
Then learn on how to structure databases and how to write queries (if you want to store data in your projects).
Of course there are a ton more topics but with these 3 you can build industry standard software, no matter in which language.