Programming in Lua (PiL) - Introduction to Lua from

Planning to rewrite this resource some. Just putting it out there. I haven’t had the time to address the shortcomings of this post and so I dearly apologise. Follow the conversation in the responses below.

For a bit of time I’ve been thinking over this. There’s been many threads on the DevForum asking where a good place to begin exploring Lua would be or where they can find documentation to help them along their learning path. There have been mentions to the Roblox Wiki, video tutorials and obscure mentions to PiL - but there wasn’t actually any dedicated thread to PiL. That’s when I thought to make this thread to share PiL so that it’s accessible to you without needing to search too deeply or come across it by chance. Just open the Resources category and wham, here it is.

The link I posted directs you to the online version of “Programming in Lua” on the official Lua website. Though it is mainly aimed towards Lua 5.0, it still holds major relevance and has the necessary know-how for you to program on Roblox. The code you write in Roblox Studio is a sandboxed version of Lua dubbed “RbxLua”. Most of what Lua has to offer is available in Studio, as well as Roblox-specific implementations. Any number of resources out there can help you all the same, but if you’re starting from zero, this may just be the hand you seek.

If you are looking to learn Lua but are unsure of where to begin, this would be a good place to flip through. It covers the basics and works it’s way down to advanced practices. Depending on your ability to comprehend the material it may take a few re-reads or questions before you understand, but at the very least you will be able to understand some things about Lua and perhaps start on basic programming.

This is not to say that you shouldn’t also read the Developer Hub’s articles or anything on Roblox’s Medium page. Both of those respective resources have amazing articles on specific subjects and also help towards such learning. PiL can help you to understand Lua concepts and tease you into exploring the awesome world of code.


Most people that want to learn how to program in Lua just want to script in their game, showing this link is going to bore or scare them from scripting.

The best place to learn is either Youtube with some videos or the Roblox wiki.

Or both.


Yea honestly I completely agree
Wiki is just so bad nowadays


Any kind of reading or non-interactive tutorial will “bore” someone. If you aren’t willing to put in the effort to learn, then you shouldn’t bother with attempting it at all. Everything comes with both the learning and the practice. In any medium you present a person that wants to learn, they still have to sit through it.

Programming in Lua is a basic and advanced introduction into coding with Lua and understanding the concepts necessary to begin using it, with all its sections explicitly divided to cover certain topics and go over them in such a way that is easily understood.

I would not ever recommend directing anyone to a YouTube video or the Roblox Wiki to learn code. Those are subjectively the two worst places to begin. Every YouTube tutorial on Roblox Programming is different on where they begin and what they define as what you should start with, whereas PiL anchors where you’re supposed to start - getting familiar with how things work first before jumping into coding.

Videos often jump straight into practice and assume that you know how things work at a very basic level. They are more interactive than reading but they don’t have the sufficient amount of knowledge one would wish to seek if they’re starting from absolute scratch.

I shouldn’t really have to explain why starting at the Roblox Wiki is a bad place. For expanding your knowledge or comparing what you learned, sure, but it’s still good to first learn the basics to the language Roblox games use first before jumping straight to practice.


It’s easy to make a lot of assumptions about what’s the best way to learn but in everyone learns a little differently.

I first learned how to program (with Lua on Roblox back in 2009) mainly by example and by reading the manual. I tend to learn best by getting a high level conceptual understanding and then drilling into API references or manuals. I found PiL frustrating and mostly ignored it.

An important thing to keep in mind about PiL is that it was written against Lua 5.0, which was released 15 years ago. There’s many places throughout the book where what it teaches doesn’t carry over to Lua 5.1, and it’s really frustrating when code you based on the book doesn’t work. It also suggests you use some fairly idiosyncratic patterns, like error"insufficient funds", which most developers don’t use.


The main problem that I have with PiL as a new learner’s resource is that it seems to be aimed at people who already understand certain vagaries about programming languages in general. For instance, in the first chapter of PiL there’s a (very brief) discussion about semicolons at the end of statements, which is most likely just going to be extremely confusing and useless if the reader doesn’t already understand how or why semicolons are used in other languages. The entire book is littered with little things like this, which is fine if you already “get” them, but borderline nightmarish if you don’t.


I’ll try editing the post in such a way that accommodates this point-out (as well as any input posted above). Thanks for bringing it to my attention.


Agreed , when i first started lua , i didnt read any of these. now i am the half of PIL and yet my understanding of lua have completly evovled. I believe that anybody who wants to become an advanced programmer should completly read it.