Beginner friendly book about Lua?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
ddabrahim
Party member
Posts: 201
Joined: Mon May 17, 2021 8:05 pm
Contact:

Beginner friendly book about Lua?

Post by ddabrahim »

Hi.

I am trying to get familiar with the ins and outs of the Lua programming language. There are lots of tutorials out there but I was wondering if is there any beginner friendly book that you could recommend?

I am currently reading the Programming in Lua 4th edition. While the book contain some very useful information, in some cases to book assumes that you already have programming experience in C or C++ and uses very complicated examples for demonstration. Sometimes feels like the book assumes I am a Computer Science graduate who is going to work on AI, data encryption and image processing algorithms.
Because I am not and I lack the programming experience and English is also not my first language, I have a hard time understanding some of the explanations and the code examples in this book.

So I was wondering if is there any other books for Lua worth considering, would you have any recommendations for me?
I am also reading all the tutorials I can find on the wiki and the web, but I was wondering if is there any nice beginner friendly books out there.
I can find lots of books for Roblox, some books for Love2D and other frameworks but only a couple for Lua in general.

I would appreciate any recommendations.
Thanks.
User avatar
milon
Party member
Posts: 472
Joined: Thu Jan 18, 2018 9:14 pm

Re: Beginner friendly book about Lua?

Post by milon »

Sheepolution is exactly what I was thinking when I clicked on this thread! I've never seen a better beginner resource, and I used it a lot when I was first learning Lua/Love. Once you've got a better handle on things, trying downloading things from the Games & Creations subforum, extract the project, and see if you can understand the code. :D
Any code samples/ideas by me should be considered Public Domain (no attribution needed) license unless otherwise stated.
User avatar
ddabrahim
Party member
Posts: 201
Joined: Mon May 17, 2021 8:05 pm
Contact:

Re: Beginner friendly book about Lua?

Post by ddabrahim »

Sheepolution is indeed an excellent "book", really nice beginner introduction to Love2D and Lua. This is what I was using to get started.
In general I have no problem coding in Love2D but I am almost certain I am not doing it right because I know next to nothing about Lua.

So I would like to focus on Lua for a bit and find a book that does not focus on any framework and game development but walk me through everything Lua has to offer in a beginner friendly way as much as possible.
The book I mentioned "Programming in Lua 4th edition" does exactly that except the beginner part. It feels like the author is targeting computer science students and experienced coders.

But thank you for the links and the advice to look in to the source of other games, I do that a lot actually but often feels like I am missing the fundamentals hence that is why I am trying to focus on Lua without any framework.
User avatar
milon
Party member
Posts: 472
Joined: Thu Jan 18, 2018 9:14 pm

Re: Beginner friendly book about Lua?

Post by milon »

That happened to me too. After sheepolution, I basically delved into topics as they came up. I also like to write my own libraries - I'm uncomfortable using code I don't understand (lots of bad experiences behind that), and if I do understand the code then I can just as easily write my own context-specific modules. That's been a major contributor to my knowledge.

I'm sorry I don't have anything further to point you to. Hopefully someone else will!
Any code samples/ideas by me should be considered Public Domain (no attribution needed) license unless otherwise stated.
User avatar
ReFreezed
Party member
Posts: 612
Joined: Sun Oct 25, 2015 11:32 pm
Location: Sweden
Contact:

Re: Beginner friendly book about Lua?

Post by ReFreezed »

You should check out the lua-users wiki if you haven't already. A bunch of information and links to Lua related things there.

There really isn't much to "get" about Lua. It's a small language with mostly the same basic functionality that you can find in any other language in general. Variables, functions & calls, arithmetic expressions, loops, some common API stuff like reading and writing files, etc. If you can already use LÖVE fine then you already know Lua, I'd say.
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
User avatar
ddabrahim
Party member
Posts: 201
Joined: Mon May 17, 2021 8:05 pm
Contact:

Re: Beginner friendly book about Lua?

Post by ddabrahim »

milon wrote:I also like to write my own libraries - I'm uncomfortable using code I don't understand (lots of bad experiences behind that), and if I do understand the code then I can just as easily write my own context-specific modules.
Yes I feel the same way and I try to develop my own modules but at times when I struggle I always wonder if is there a better way to do it at which point I look at the source of other libs and games but often those are undocumented and I can't really understand the code. I never really know for certain if its because of my lack of experience or because the code is not very clean. Personally I like to write clean, self documenting code, so I can understand by just looking at it but when I look at the code of others 90% of the time I have no idea what is happening.

So I figured the best thing to do for me is to go back to the beginning and get more confident with Lua on it's own without using any framework by writing some console applications and games maybe. Something I was always trying to avoid because it is boring :D
ReFreezed wrote:You should check out the lua-users wiki if you haven't already. A bunch of information and links to Lua related things there.
There really isn't much to "get" about Lua. It's a small language...If you can already use LÖVE fine then you already know Lua, I'd say.
Thanks, that link looks very promising, I'm going to give it a good read.
I can use Love2D for the most part, but especially when I look at the code of others, something tells me I am not doing it right and I'm missing something. There are some programming concepts and techniques that would be beneficial to get familiar with before I dive deep in to coding games and my own modules and libs in Love2D.
User avatar
milon
Party member
Posts: 472
Joined: Thu Jan 18, 2018 9:14 pm

Re: Beginner friendly book about Lua?

Post by milon »

ddabrahim wrote: Wed Dec 15, 2021 6:37 am ... at which point I look at the source of other libs and games but often those are undocumented and I can't really understand the code. I never really know for certain if its because of my lack of experience or because the code is not very clean. Personally I like to write clean, self documenting code, so I can understand by just looking at it but when I look at the code of others 90% of the time I have no idea what is happening.
Wow, you sound exactly like me! That's my coding philosophy: clean & well documented code. And the way I learn - look at how others have done it. I've struggled with understanding others' libraries & sample code, but for the most part I've been able to fill in the gaps. Although I've probably got giant holes I know nothing about, lol.

I'm going to check out that wiki too. Thanks ReFreezed!
Any code samples/ideas by me should be considered Public Domain (no attribution needed) license unless otherwise stated.
User avatar
dusoft
Party member
Posts: 635
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

Re: Beginner friendly book about Lua?

Post by dusoft »

ddabrahim wrote: Wed Dec 15, 2021 6:37 am
milon wrote:I also like to write my own libraries - I'm uncomfortable using code I don't understand (lots of bad experiences behind that), and if I do understand the code then I can just as easily write my own context-specific modules.
Personally I like to write clean, self documenting code, so I can understand by just looking at it but when I look at the code of others 90% of the time I have no idea what is happening.
When you feel like this in 90% of cases, do consider whether your code would be readable for those 90% other developers. Understanding code of others comes with experience. Code reuse (libraries, classes) is a strength, not a weakness. Writing something from scratch requires serious understanding of protocols, formats etc. you are often not going to achieve. Moreover you will likely introduce security issues you don't even know about.
User avatar
Gunroar:Cannon()
Party member
Posts: 1142
Joined: Thu Dec 10, 2020 1:57 am

Re: Beginner friendly book about Lua?

Post by Gunroar:Cannon() »

Yeah, I can understand, like, any code I see due to me seeing and working with and observing lots of libraries and projects. Doing this in different coding languanges really helps and now I can kind of understand any code given the context.
The risk I took was calculated,
but man, am I bad at math.

-How to be saved and born again :huh:
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 5 guests