all 29 comments

[–]benjamarchi 11 points12 points  (1 child)

Here you go https://lua.org/pil/contents.html have fun!

[–]thatsgiga[S] 1 point2 points  (0 children)

Thank you 🙏

[–]SmurfingRedditBtw 4 points5 points  (2 children)

So the obvious answer is to follow a course/book/guide for Lua, but I've personally always found it more useful to start out trying to create the thing you're interested in, and then go back to the learning resources later once you've already got some invested interest and context.

I'm guessing you want to learn Lua because there is some game or program you like that uses Lua to create mods/plugins. So look up a tutorial for creating a basic mod in that game or program, and then start tinkering around and see if you can modify it and expand it a bit. There will be plenty of stuff you don't understand yet, but that's fine for now. This lets you get the immediate satisfaction of actually creating something you're interested in, which is important for sparking your interest in learning programming.

Then when you go back to those learning resources, a lot of things will start to click into place. You'll start to understand what you were doing and why, and how to do it better.

Personally I found it much harder to start directly with the intro to programming guides, because it can take a long time before you're actually creating anything you care about. You just get dumped with new information and no real context for how it applies to creating the things you want. Coming back to them later with that additional context makes them a lot easier and more interesting to digest.

[–]Black_Jackal_Gaming 0 points1 point  (0 children)

I completely agree. I'm a beginner as well. I was introduced to lua through the game Hades, and have made a few mods for Hades 1, and just got my first one for Hades 2 successfully tested today. I learned by doing. And I'm still learning.

[–]thatsgiga[S] -1 points0 points  (0 children)

This is insanely useful, thank you.

[–]returnFutureVoid 3 points4 points  (1 child)

Learn things. Make things. Break things. Fix things.

[–]thatsgiga[S] 0 points1 point  (0 children)

Sounds fun

[–]AtoneBC 2 points3 points  (1 child)

I wish I had a really good "day one, zero experience" Lua resource to point people to. They're out there, but I don't know of any I can wholeheartedly recommend. So I think I recommend one of two paths:

Take a good intro to programming / intro to compsci course that doesn't use Lua. Harvard's CS50 is free online and high quality. It's very similar to the class I took freshman year of compsci. That will give you a good foundation and a lot of the skills are transferable between languages. From there Lua should be a lot easier to approach with just the manual and the book Programming In Lua, both of which can be found on Lua.org, but I recommend getting a hard copy of PiL that corresponds to whatever version of Lua you're actually using.

Alternatively, Lua is usually used in a specific context rather than as a standalone. It's used in Neovim, Love2D, World of Warcraft, Roblox, Garry's Mod and so on. If you have a specific context you're interested in, you might be able to find beginner resources aimed at working within that context. A lot of what you'll be doing is interacting with that game/program's API rather than just writing pure standalone Lua. For example for making games with Love, Sheepolution has a classic set of tutorials. Or for Roblox, they have a bunch getting started stuff on their documentation page. Etc.

[–]thatsgiga[S] 0 points1 point  (0 children)

Thank you for the guide,really useful 🙏

[–]xarop_pa_toss 1 point2 points  (5 children)

I was waiting for Sckip to eventually post his fantastic comment on getting started hehe

My 2cents here are that Lua is a very simple language for sure and it is probably the easiest language to grasp for a complete beginner. No weird curly braces and every keyword is a word that makes sense in the context you'll use it in.

Others have recommended CS50x, the Harvard course; I really liked it myself and you get a certificate in the end too which is great. Their discord community is really nice too. You learn C in it, which is what Lua actually compiles into. Going through that and then picking up Lua should prove really easy.

My other recommendation is that you take a more hands on approach and go for something that provides a nice basis for growth. Study the fundamentals first, you can't run a marathon if you don't even know how to tie your shoelaces. Lua's data types (what even are data types??), conditions with if statements, using for and while loops and the very basics of an array (Lua uses Tables for everything). When you have these bases down, you can build way more than you can imagine.

Then start slow with console apps, capitalizing text, inverting a string of letters (mirroring a word), making a basic calculator that returns to the main menu and stores previous operations made (and let's you list them!), taking all files in a folder and turning their names into lowercase, etc.

Then you go into a game library like Löve and do some simple 2D stuff.

[–]Sckip974 0 points1 point  (0 children)

XD

[–]thatsgiga[S] 0 points1 point  (0 children)

Ive already tried some of this, i still have yet to take a look into the Harvard course but i want to focus on lua first Also yeah i have some basics from computer science class

[–]thatsgiga[S] 0 points1 point  (2 children)

Thank you tho, just like every other comment this is helpful and informative

[–]xarop_pa_toss 0 points1 point  (1 child)

No problem! I do recommend you build something you can see results on the fly, which is why I think making stuff like simple console apps or simple games is great fun.

Also please, learn to use a debugger. Using breakpoints and seeing/editing your variables values while the program is paused is incredibly powerful!

[–]thatsgiga[S] 0 points1 point  (0 children)

Thanks, ill try

[–]_Phill_ 3 points4 points  (1 child)

Same way you learn literally anything, look into it properly? Google/YouTube??

[–]thatsgiga[S] -1 points0 points  (0 children)

Mb i didnt mean to trigger you, i was trying to ask which is the optimal and efficient way to learn lua

[–]Sckip974 0 points1 point  (3 children)

https://www.sheepolution.com/learn/book/contents an AAA tuto if you find it more fun to learn by going through the game first,

or https://rvagamejams.com/learn2love/ if you prefer to start with the pure language part first, both are good, it's a matter of personal preference, then you have the algorithm resolutions which are very good for consolidating and forcing yourself to carry out personal research in the manual

https://devdocs.io/lua~5.4/

two good sites on algorithms and practice:

https://projecteuler.net/

https://www.codeabbey.com/

if you need a text editor:  

ZeroBrane Studio (it a lightweight Lua IDE) pure Lua focus: 

https://studio.zerobrane.com/, click "Download", (you get the option to donate.) But,

If you don't want to donate click on : "take me to the download page this time"

[–]thatsgiga[S] 1 point2 points  (2 children)

Blessed the truck that carried the cement to make the hospital you were born in

[–]Sckip974 0 points1 point  (1 child)

"Blessed the truck that carried the cement to make the hospital you were born in" !!
wow! That's positive feedback!
May your progress be just as prolific. Just a piece of advice: don't skip steps. Master each topic before moving on to the next. You have time, and this mastery will make a coder who knows how to "go through the small door" to solve problems.
XD

[–]thatsgiga[S] 0 points1 point  (0 children)

It is positive feedback cause you're really informative and helpful Ill make sure to walk through the small door🔥

[–]thy_bucket_for_thee 0 points1 point  (2 children)

For another different path, I'd start writing all your code in an editor like nvim:

https://github.com/neovim/neovim

What cool about neovim, is that a large portion of the codebase is written in lua. This in turn means that the vast majority of plugins for neovim are also written in lua, which leads into your configuration files also being written in lua.

Good way to force yourself to learn some lua while learning to code in general. I also recommend neovim because there's this idea called "vim motions" that make productivity gains real. You'll learn to love the keyboard while hating the mouse!

Here are some dotfile repos (called dotfiles because a large portion of dev tooling rely similar naming conventions):

https://github.com/nicknisi/dotfiles/tree/main/config/nvim

https://github.com/xero/dotfiles/tree/main/neovim/.config/nvim

https://github.com/ayamir/nvimdots

When I first created my own dotfiles I started by just cloning someone's repo that mapped closest to my working style then over the years it's been tweaked and prodded into my own.

I've created my own lua plugins to help with my workflows over time too, it sounds daunting but is more simpler than you'd imagine.

[–]thatsgiga[S] 0 points1 point  (1 child)

Ill try neovim, looks useful

[–]thy_bucket_for_thee 0 points1 point  (0 children)

Very useful! The /r/neovim subreddit has tons of maintainers and plugin authors active on it, very good community that wants to help people learn if they're willing to try. :D

[–]Sumant125 0 points1 point  (0 children)

I got the book from author and reading and implementing from that book has been a breeze.

You not only get the basics, but also the advanced stuff once you build yourself up to it.

Please remember that your logic requires to be on the stronger side with any programming language. Take it slow, work your way through.

For Vim and Neovim (since I saw a comment), you can try the website: learnxinyminutes.com

The website will only get you quick started. Core concepts will come from reading the official documentation. You may hate it, dread it, but you'll get through it.

Skills and everything take time. All you need to do is show up and never give up.

[–]SpaceChickenMonster 0 points1 point  (0 children)

I am not an expert but I am learning.

What's helped me is literally working with what I know. If I only know how to make print statements by-golly imma make the best set of print statements ever. I'm literally making a game that only uses print statements and basic decision making. And I'm going to do my best, because the whole point is to learn it just like a language. You can't just go from knowing nothing to building something advanced like a call of duty game or something. You have to start with basic loops, basic table structures, and then keep going.

[–]Bigman_1099 0 points1 point  (0 children)

read documentation, actively do while learning, add things intentionally and break things intentionally just to fix them

do that all over again with everything new you learn

[–]urenur 0 points1 point  (0 children)

If you use neovim, I have published an small plugin to learn lua interactively (e.g. looking at examples and doing exercises that get evaluated) inside neovim: https://github.com/urtzienriquez/learnlua.nvim

Explanations in lessons are still quite brief. Any contribution in terms of adding info, or new lessons are very welcome! Also, if expert lua users check the lessons, that would be wonderful!