
Discover Lua, an open source language built on C, used across servers and mobile apps. Learn basics and applications for beginners and advanced users, with text editor and command line.
Explore Lua, a lightweight, extensible language written in ANSI C that integrates with C, offering safe execution and automatic memory management, plus scripting for game programming, web extensions, databases.
Explore how Lua handles variables, including local and global scope, table fields, and the distinction between lvalues and rvalues, with practical examples of initialization, assignment, and swapping.
Explore Lua data types, including nil, boolean, number, string, function, user data, thread, and table, and learn how the type function reveals a value’s type and nil defaults.
Explore arithmetic, relational, logical, and miscellaneous operators in Lua, and learn operator precedence with practical examples using a and b values.
Practice Lua operators hands-on, covering arithmetic, relational, logical, and miscellaneous operators with examples of plus, minus, multiply, divide, modulus, exponent, unary minus, concatenation, and length.
Explore how to run a block of code multiple times using while, for, and repeat until loops in Lua, including nested loops.
Learn how the Lua while loop executes a statement while a condition is true, with syntax while <condition> do ... end, and that it may run zero times.
Explore Lua's for loop as a repetition control structure, mastering its syntax with init, limit, and step, and see a practical example printing 10 down to 1.
Explore the repeat until loop in Lua, which checks the condition at the bottom and guarantees at least one execution; learn its syntax with a hands-on counting example.
In Lua, the break statement immediately terminates a loop, stopping the innermost loop in nested structures; use syntax break, as shown by a while loop that prints 10 to 15.
Explore Lua decision making statements by testing conditions with if, if else, and nested if. True or non null values count as true, while false or nil are false.
Learn how to use the if statement in Lua by evaluating a boolean expression, executing a code block when true, and skipping it when false.
Explore how to implement if, else, and else if statements in Lua, including syntax, truthy values (true or non-nil; zero is true) vs false or nil, and practical examples.
Explore nesting if statements in Lua, including else if, using syntax if boolean expression then if boolean expression then end, with an example where a=100 and b=200 prints their values.
Define and call functions in Lua, using local scope, function names, and parameters. Show return values, multiple returns, and simple examples like max as you invoke functions and pass arguments.
Explore Lua strings, including initialization with single quotes, double quotes, or double square brackets, and use escape sequences to format output in practical print examples.
Master Lua string manipulation using functions like string.upper, string.lower, string.gsub, string.find, and string.format to transform and replace substrings. Practice reversing, concatenating, length, and repetition.
Explore arrays in Lua, including one‑dimensional and multi‑dimensional structures built with integer indexing tables, dynamic size, for loops, nil handling, and indexing beyond one-based bounds.
Discover how lua tables function as the primary data structure, enabling arrays and dictionaries with numeric or string keys. Understand table creation, references, and basic garbage collection basics.
Explore Lua table manipulation with built-in functions like table.concat, table.insert, table.max, table.remove, and table.sort. The hands-on examples cover concatenation, insertion, max index, removal, and sorting with an optional comparator.
Discover how Lua modules function as tables loaded with require, hosting functions and variables under a single namespace, and learn multiple ways to call them.
Explore how metatables modify table behavior in Lua, using setmetatable and getmetatable, and implement __index and __newindex to manage missing keys and operator-like extensions.
The video demonstrates rawset to set key-value pairs and explains __newindex behavior on main and meta tables, then shows merging tables via __add, and iterating with ipairs and pairs.
Explore how Lua coroutines enable cooperative multitasking with a single running coroutine at a time, using resume and yield, and master core functions like create, wrap, running, status.
Explore Lua coroutines with yield and resume, creating and resuming coroutines to yield numbers 1 through 5, looping, and comparing coroutine behavior to threads.
Explore file handling in Lua using the io library, including implicit and explicit file descriptors and modes like r, w, a, r+, w+, and a+, with practical examples.
Explore Lua error handling: distinguish syntax and runtime errors, and apply assert, error, pcall, and xpcall with protected calls.
Explore Lua's automatic memory management and built-in garbage collection, learn how to monitor memory usage with collect garbage count, and control collection cycles using pause, stop, and step actions.
Explore object oriented programming with Lua, detailing classes, objects, inheritance, and encapsulation, and build a simple square class to calculate and print area.
Lua is an open source language built on top of C programming language. Lua has its value across multiple platforms ranging from large server systems to small mobile applications. This course covers various topics ranging from the basics of Lua to its scope in various applications. This course is designed for all those readers who are looking for a starting point to learn Lua. It has topics suitable for both beginners as well as advanced users. It is a self-contained course and you should be able to grasp the concepts easily even if you are a total beginner. However it would help if you have a basic understanding of working with a simple text editor and command line.
Lua is an extensible, lightweight programming language written in C. It started as an in-house project in 1993 by Roberto Ierusalimschy, Luiz Henrique de Figueiredo, and Waldemar Celes.
Common Use Cases
Game Development
Embedded Systems
Scripting Inside Applications
Configuration Files
IoT and Robotics
It was designed from the beginning to be a software that can be integrated with the code written in C and other conventional languages. This integration brings many benefits. It does not try to do what C can already do but aims at offering what C is not good at: a good distance from the hardware, dynamic structures, no redundancies, ease of testing and debugging. For this, Lua has a safe environment, automatic memory management, and good facilities for handling strings and other kinds of data with dynamic size.