Learn Lua in an Hour

Share it with your friends Like

Thanks! Share it with your friends!


This video tutorial covers all the essentials of the Lua programming language in just under an hour.

I’m trying something experimental with this video, which is to post the entire script on github here:


I’d like for this video to be world-editable, a bit like a wikipedia page. If you have suggestions for the script (that don’t make it longer), please do the usual git thing and send me a pull request.

Here are some ideas for future videos I might make. Please comment if you have any requests for these topics, or anything else programming-related!

* Intro to OpenGL
* Intro to the Love game engine
* Linear algebra for OpenGL
* Bash tutorial
* Colorspaces tutorial

I’m using Lua and C to build an independent game called Apanga. If you like games, please check out http://apanga.net/ !



Ed Coyne says:

great video, love the fast pace. as an experienced software engineer new to lua it was perfect to get up to speed quickly.

Doug Gale says:

Amazing tutorial. I loved the quick pace. You really have a talent for teaching!

Jadon BTMurder says:

If I pay attention and watch everything in this video, this will give me a jump start in developing? Would I know everything I need to know? (Or most of it?)

Jadon BTMurder says:

So… Uh this works for roblox, right?

Aiqun Huang says:

At 38:56, in the definition of Sequence:next(), you have "return self.last_num + 2", my question is "self" is "Sequence" and is a metatable of "new_seq", and "last_num" is one key of "new_seq", but how "self.last_num" works? I think "last_num" is not a key in "self".

Anthony Rozario says:


Zakarya ISSER says:

You have a great library , how much did cost all those books ?

Cameron Kerr says:

Fantastic coverage for a 1-hour video; would all videos be this useful. I would have liked to see some little commentary around how strings are encoded, and whether the strings are/can be Unicode values, and what happens when such characters/bytes are encountered. FWIW; I'm using Lua inside of Nginx (well, Openresty) to implement authentication and access-control for Elasticsearch's RESTful API.

Garrett Bradley says:

Hello. So i was codeing some files to help my friend learn lua he says you tube didn't help that much so i was coding some while operation in it and it keeps on giveing me this error

lua: while.lua:18: '=' expected near 'end'

have_key = false
hi = print("Hello")
input = io.read()

while not( have_key == true and input == "hello") do

if input == "hello" then
have_key = true
print("you now gave the key")

please help me

Christopher Kopp says:

Thank you for the fantastic primer. I wish more were like it. I'd love to see one on userdata and threads. FWIW, I didn't have the same issues some mentioned with reading the text.

PixelOutlaw says:

Good video. I appreciate the pace of the whole thing.
As some others have said, please use a lower resolution video next time or increase the font size in your REPL.

bike4aday says:

This is such an information-packed video. Great work, Tyler

Tomas Av. says:

would be awesome but green color on black just very hard to see

Rishabh Bhargava says:

Hey Tyler, this was a great video. As a beginner to Lua, I was with you the entire time till the fun example of the Grapher began, but then keeping track of the code and the problem together became too much. Hopefully going through the script again should do the trick. Thanks a lot for a brilliant video again!

Jetset Willy says:

Where is my microscope ?
all I see is a black screen with tiny green pixels.
BTW it helped me, thanks for this.

Aurs says:

What program you used in this video?

William Maggioni says:

Hello… I've been learning lua programmin language and I found your toutorial… I made one program which should order 3 numbers from minimu to maximum… i get two return: from minimum to maximur (right result) and from maximum to minimum. Sometimes the order of output is inverted. Can you explain me the reason of the aoutput.
Thanks for your help
 Here below the program: *********************************************************************************************** function main()

frase = ("La sequenza corretta è: ")

 print ("Questo programma mette in sequenza tre numeri…")
 print ("Digita il primo numero…")
 print ("Hai digitato: ", a)
 print ("Digita il secondo numero…")
 print ("Hai digitato: ", b)
 print ("Digita il terzo numero…")
 print ("Hai digitato: ", c)

 frase = ("La sequenza è: ")
 if b<a and a>c then
  print (frase, b, a, c)

 if c<a and a>b then
  print (frase, c, a, b)

 if a<b and b>c then
  print (frase, a, b, c)
 if c<b and b>a then
  print (frase, c, b, a)

 if a<c and c>b then
  print (frase, a, c, b)
 if b<c and c>a then
  print (frase, b, c, a)

function uscita()
 print ("Vuoi uscire dal programma: Y\N")
 if x=="Y" then
 elseif x=="N" then
  print ("DEVI DIGITARE: "Y" OPPURE "N"!!!")


Leonardo Sedevcic says:

it is possible to use LUA scripting and create an rgb split effect (post process)?

Write a comment