Master the Lua Scripting Language

Course description

This is a comprehensive course dedicated to the language Lua, one of the world's favorite scripting languages. Lua is fast, small, and super easy to integrate with C and C++, which makes Lua an excellent choice to extend and script compiled C and C++ applications.

This course is divided in three parts:

lua language tutorial

1. The first part is a beginner-friendly journey into the building blocks of the Lua language. We'll start from the very beginning and look at things like variables, expressions, conditionals, loops, functions, tables, object-oriented programming, functional programming, and other popular tools and modules of Lua.

lua language c api

2. The second part is aimed at intermediate-experienced developers that want to learn how to integrate Lua with their native C or C++ projects. We'll put our C-programmer's hat on and review how to embed the Lua programming language inside a compiled application using the powerful Lua C API.

lua roblox tutorial

3. The third and last part is a series of short bonus lectures. These lectures will explain how the Lua language is used inside Roblox Studio. Roblox is an example of a popular game engine that uses a dialect of Lua as its main scripting language.

The tools you'll need

All you need is a Lua interpreter. The official Lua tools are all cross-platform, which means you'll be able to code along on either Windows, macOS, or Linux!

c++ game engine platform

Is this course for you?

This course has no prerequisites. We'll cover the official Lua language from the ground up, so even beginners with no prior experience in coding are welcome to join!

This is not a course about creating Roblox games! Our main focus is Lua, the programming language.

How is this course different?

This is a complete immersion in the world of Lua! We'll learn how to think like Lua programmers, carefully covering the syntax and the most popular modules from Lua.

lua game scripting

Differently than most Lua resources out there, this course also covers the integration of Lua with native C and C++ code! We'll learn to work with the Lua C API to embed the Lua language inside a C project, exposing Lua to be used as a proper scripting language.

About the instructor

gustavo pezzi

Gustavo Pezzi is a university lecturer in London, UK. He has won multiple education awards as a teacher and is also the founder of pikuma.com.

Gustavo teaches fundamentals of computer science and mathematics; his academic path includes institutions such as Pittsburg State University, City University of London, and University of Oxford.

teaching certification
higher education academy
pgclt teaching certification
bpp university award

Course content

12 hours total length 14 Chapters Last updated July 2022
  • Motivations & Learning Outcomes
  • How to Take This Course
  • History of the Lua Language
  • Goals of the Lua Language
  • Using Lua in the Web Browser with REPL
  • Installing Lua on Linux
  • Installing Lua on macOS
  • Installing Lua on Windows
  • Our First Lua Script
  • Variables
  • Exercise: Variables
  • Incrementing and Decrementing Values
  • Quiz: Variables and Expressions
  • Conditional Statements
  • The elseif Statement
  • Exercise: Conditionals
  • Logical Operators
  • Quiz: Conditionals
  • String Manipulation
  • Multi-Line Strings
  • Multiple Assignments with Lua
  • Popular Standard Library Modules
  • Exercise: Strings and Random Numbers
  • The For Loop
  • The While Loop
  • Loop Options
  • Quiz: Loops
  • Variable Scope
  • Local Scope and Lua Chunks
  • Syntax Errors and Semantic Errors
  • Reading Values from the Keyboard
  • Finding the Distance Between 2D Points
  • Finding the Angle Between 2D Points
  • Exercise: Loops
  • Lua Functions
  • Exercise: Functions
  • Lua Tables
  • Pairs and Indexed-Pairs
  • Examples of Lua Tables
  • Exercise: Looping Table Entries
  • Tables as Arrays
  • Tables as Matrices
  • Exercise: Tic-Tac-Toe Project
  • Metatables
  • Exercise: Metatables
  • Object-Oriented Programming in Lua
  • Creating Classes and Objects in Lua
  • Quiz: OOP in Lua
  • Higher-Order Functions and Closures
  • Variadic Functions
  • Exercise: Variadic Functions
  • Coroutines in Lua
  • Starting our C Example Project
  • Executing a Lua File from C
  • Get Lua Global Values in C
  • Accessing the Lua Stack
  • Push, Pop, and Peak
  • Quiz: The Lua Stack
  • Calling Lua Functions from C
  • Checking for Script Errors
  • Calling Native C Functions from Lua
  • Working with Userdata
  • Sending and Receiving Userdata
  • Reading Lua Tables in C
  • Installing SDL
  • Creating and Rendering an SDL Window
  • Fixing the Game Loop Timestep
  • Controlling Player Movement with Lua
  • Exercise: Implementing the Rectangle() Function
  • Lua JIT
  • Next Steps
  • Lua and Roblox
  • Downloading Roblox Studio
  • Roblox Parts and Properties
  • Roblox Vectors and Colors
  • Roblox New Object Instance
  • Exercise: Sun-Moon Script
  • Roblox Loops and the Wait() Function
  • Roblox Loops and Conditionals
  • Roblox Events
  • Roblox Humanoid Properties
  • Roblox Players and Characters
  • Roblox Models and Assets
  • Roblox Players and Characters
  • Roblox Terrain Editor
  • Roblox Lighting and ClockTime
  • Roblox Leaderboard
  • Roblox Debugging
  • Roblox CFrame
  • Roblox Following Parts
  • Getting Help on Roblox Scripting
  • Versions of Lua
  • Building Lua 5.4 from Source on Linux
  • Conclusion and Next Steps

What students are saying

5.00
5 star
100.0%
4 star
0.0%
3 star
0.0%
2 star
0.0%
1 star
0.0%
Andres Mata
Profesor de talleres tecnológicos
"I loved this course! I enrolled in this course because I was fascinated by Pico-8 and TIC-80 fantasy consoles and wanted to understand how the communication between Lua and C worked. I have to admit that I kind of hated of Lua in the beginning but after taking this course I realized that was because I didn't really understand the language. Now I love it, and it's one of my favorite languages."
08 May 2022
William Allenr
"Everything I never thought I needed! I came here to learn enough about LUA to write and read Table Top Simulator script. But ended up learning so so much more. Gustavo teaches with passion and is so relatable. I will be taking more of his courses for sure."
31 Mar 2022
Alexandre Garcia
Alexandre Garcia
"The OOP section was a life changer and helped my game's data structure."
19 Jan 2022
Hannah Kloepper
Hannah Kloepper
"From the moment the class first started, to the very end - I understood EVERY concept he brought to the table. The exercises REALLY help solidify and test your knowledge. Also, they're super fun! I had so much fun with this class! I can't wait to continue to learn more about Lua and truly become a master! Thank you Mr. Pezzi!"
20 Oct 2021
Ben Pavy
"If you cannot program lua fairly well once you have finished this course then sorry but you have got problems.

Great course, 5/5!"
26 Apr 2021

Other similar courses

3D Computer Graphics Programming

35 hours
  • Create a 3D software renderer from scratch using the C programming language.
raycasting texture c

Raycasting Engine Programming with C

18 hours
  • Write a raycasting engine with textures and sprites using the C programming language.

Game Physics Engine Programming

35 hours
  • Learn how to create a 2D rigid-body game physics engine from scratch with C++.