Beginner friendly book about Lua?

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

Re: Beginner friendly book about Lua?

Post by ddabrahim »

dusoft wrote: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.
I do agree with you, however I am almost always try to do things that the libraries are not designed for. For example, I needed camera in my project, I looked at the camera libraries but none of them worked with canvases so I decided to create my own. It is lack many features but at least works the way I want it. Or more recent case is I need a GUI library and the one I looked at for some reason did not centered the labels on the panels and was unable to pin certain menus to a certain panel and others lack features I needed. So currently I am working on my own GUI library, so far I have a panel and a button with a click and release event listener that I can pin to the panel, I have a long way to go but at least I can center the label.

Normally I would be happy to study the internal workings of these libraries, implement my own ideas and contribute to the project if it's useful, help it grow. But when I look inside the source and I see no comments, no documentation, I am required to debug and reverse engineer the code in order to find what I need is discouraging me. I feel like I am wasting my time.
dusoft wrote: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.
I am almost certain the 90% would have no problem understanding my code because due to my bad memory I picked up the habit to use long, descriptive names for variables and methods and I use a lot of comments and structure my code in a way you can read it like a book. Even if you have no programming knowledge you have some idea what is happening by just reading the comments. Of course if my code is practical and efficient is an other question, I certainly lack experience and make lots of mistakes. This is why I want to get to the bottom of this and learn as much about Lua as possible before I continue developing my own libraries and modules.
grump
Party member
Posts: 947
Joined: Sat Jul 22, 2017 7:43 pm

Re: Beginner friendly book about Lua?

Post by grump »

ddabrahim wrote: Thu Dec 16, 2021 6:30 am This is why I want to get to the bottom of this and learn as much about Lua as possible before I continue developing my own libraries and modules.
Lua is tiny, there's not that much to learn. What you need is more programming experience and that comes only with time and practice. Maybe try other languages and environments, it can be very helpful to get a deeper understanding of programming concepts. Do you know Rosetta Code?
User avatar
dusoft
Party member
Posts: 497
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

Re: Beginner friendly book about Lua?

Post by dusoft »

ddabrahim wrote: Thu Dec 16, 2021 6:30 am I do agree with you, however I am almost always try to do things that the libraries are not designed for. For example, I needed camera in my project, I looked at the camera libraries but none of them worked with canvases so I decided to create my own. It is lack many features but at least works the way I want it. Or more recent case is I need a GUI library and the one I looked at for some reason did not centered the labels on the panels and was unable to pin certain menus to a certain panel and others lack features I needed. So currently I am working on my own GUI library, so far I have a panel and a button with a click and release event listener that I can pin to the panel, I have a long way to go but at least I can center the label.
Once you have these ready, please publish them for others on Github or such as open source, so they can download and reuse.
Last edited by dusoft on Sat Dec 18, 2021 3:28 pm, edited 1 time in total.
User avatar
ddabrahim
Party member
Posts: 183
Joined: Mon May 17, 2021 8:05 pm
Contact:

Re: Beginner friendly book about Lua?

Post by ddabrahim »

@dusoft Yes, If it turn's out to be functional and useful I'm going to share it with full documentation for sure.

@grump I certainly need more practice and I understand Lua is tiny compared to other languages but I was just hoping I could maybe find some useful tips, hints practices in books to get me up on speed.
I didn't know about Rosetta Code, it is going to be extremely useful to look at some code examples. Pretty neat, thanks for the link. :)
grump
Party member
Posts: 947
Joined: Sat Jul 22, 2017 7:43 pm

Re: Beginner friendly book about Lua?

Post by grump »

ddabrahim wrote: Thu Dec 16, 2021 8:54 pm I was just hoping I could maybe find some useful tips, hints practices in books to get me up on speed.
There's just not that much to say about Lua in particular. The things you're struggling with, and programming in general, transcends languages. It's all about learning concepts. How to apply them in specific languages is just an implementation detail. So most of the useful material you can find will not be about Lua, and most of what's there for Lua is of mediocre quality at best, highly specific to some framework, and often written by people who don't know much more than you do.
User avatar
ddabrahim
Party member
Posts: 183
Joined: Mon May 17, 2021 8:05 pm
Contact:

Re: Beginner friendly book about Lua?

Post by ddabrahim »

grump wrote:There's just not that much to say about Lua in particular...It's all about learning concepts....most of the useful material you can find will not be about Lua, and most of what's there for Lua is of mediocre quality at best, highly specific to some framework.
Thanks. It is also my experience that most Lua tutorials and books are focusing on very specific frameworks and mostly game development often without getting too deep in to any subject. The book "Programming in Lua" does contain some very useful info and hints but the way the author explain things sometimes is a bit confusing to me, I begin to skip entire chapters because my brain just melt and I can't follow the explanation of the author. It is certainly because of my lack of experience.

So then if there is no such book for Lua that could teach me the concepts from a beginner perspective, then I need to look in to some other languages and books specifically to learn these concepts. Maybe it is time for me to look in to C++, could also be useful since Love2D is written in C++ and the author of the book "Programming in Lua" is also refer to how things are done in C and C++ all the time.

Thanks a lot!
Really appreciate all the help.
User avatar
pgimeno
Party member
Posts: 3548
Joined: Sun Oct 18, 2015 2:58 pm

Re: Beginner friendly book about Lua?

Post by pgimeno »

Umm... have you tried the manual? Sure it's not a book nor a tutorial, but it is certainly concise and to the point, explaining what the language has and how it behaves exactly, covering every detail.
User avatar
ddabrahim
Party member
Posts: 183
Joined: Mon May 17, 2021 8:05 pm
Contact:

Re: Beginner friendly book about Lua?

Post by ddabrahim »

@pgimeno Thank you for the recommendation. Yes, I did have a look at the manual but in some cases feels like I need more context to really grasp some concepts. Certainly for people with experience it is enough to read through and see how to implement things but it is a bit of a struggle for me at the moment. As it was pointed out in this thread, it is require experience which comes with practice and time. I would like to get things right at first attempt but I guess the best way forward for me is to get things done in any way I can that works, do my research as I am making progress and the enlightenment will come eventually. :awesome:
Nelvin
Party member
Posts: 124
Joined: Mon Sep 12, 2016 7:52 am
Location: Germany

Re: Beginner friendly book about Lua?

Post by Nelvin »

Maybe the Lua Gems book might be worth a look? It's a bit old but as LuaJIT is based on 5.1 it's a decent fit (and even though some details may have changed, Lua, as a language hasn't changed that much since version 5.

https://www.lua.org/gems/
https://www.lua.org/gems/sample.pdf
User avatar
ddabrahim
Party member
Posts: 183
Joined: Mon May 17, 2021 8:05 pm
Contact:

Re: Beginner friendly book about Lua?

Post by ddabrahim »

@Nelvin Thanks a lot for the recommendation, I really liked the sample about performance tips. Looks very promising, I'll make sure to put this book on my list to read. Even if not everything is going to be applicable to LuaJIT and Love2D, it could offer some context. :)
Post Reply

Who is online

Users browsing this forum: No registered users and 26 guests