This Lua tutorial lets you explore a new language, Lua. This tutorial has everything from fundamentals of the programming language to advanced concepts. After completing this tutorial, you will find yourself good with programming using Lua.
Lua Tutorial Home Whiteboard Practice Code Graphing Calculator Online Compilers Articles Tools Categories Explore Categories Find the perfect tutorial for your learning journey Python TechnologiesDatabasesComputer ProgrammingWeb DevelopmentJava TechnologiesComputer ScienceMobile DevelopmentBig Data & AnalyticsMicrosoft TechnologiesDevOpsLatest TechnologiesMachine LearningDigital MarketingSoftware QualityManagement Tutorials View All Categories Tutorials Courses Jobs Login Lua Tutorial Lua - Home Lua Basics Lua - Overview Lua - Environment Lua - Basic Syntax Lua - Comments Lua - Print Hello World Lua - Variables Lua - Data Types Lua - Operators Lua - Loops Lua - Generic For Lua - Decision Making Lua - Date and Time Lua Functions Lua - Functions Lua - Multiple Results Lua - Named Arguments Lua - Default/Optional Arguments Lua - Closures Lua - Uses of Closures Lua - Local Functions Lua - Anonymous Functions Lua - Functions in Table Lua - Proper Tail Calls Lua Strings Lua - Strings Lua - String Concatenation Lua - Loop Through String Lua - String to Int Lua - Split String Lua - Check String is NULL Lua Arrays Lua - Arrays Lua - Multi-dimensional Arrays Lua - Array Length Lua - Iterating Over Arrays Lua - Slicing Arrays Lua - Sorting Arrays Lua - Merging Arrays Lua - Sparse Arrays Lua - Searching Arrays Lua - Resizing Arrays Lua - Array to String Conversion Lua - Array as Stack Lua - Array as Queue Lua - Array with Metatables Lua - Immutable Arrays Lua - Shuffling Arrays Lua Iterators Lua - Iterators Lua - Stateless Iterators Lua - Stateful Iterators Lua - Built-in Iterators Lua - Custom Iterators Lua - Iterator Closures Lua - Infinite Iterators Lua - File Iterators Lua - Table Iterators Lua - Numeric Iterators Lua - Reverse Iterators Lua - Filter Iterators Lua - Range Iterators Lua - Chaining Iterators Lua Tables Lua - Tables Lua - Tables as Arrays Lua - Tables as Dictionaries Lua - Tables as Sets Lua - Table Length Lua - Table Iteration Lua - Table Constructors Lua - Loop through Table Lua - Merge Tables Lua - Nested Tables Lua - Accessing Table Fields Lua - Copy Table by Value Lua - Get Entries from Table Lua - Table Metatables Lua - Tables as Objects Lua - Table Inheritance Lua - Table Cloning Lua - Table Sorting Lua - Table Searching Lua - Table Serialization Lua - Weak Tables Lua - Table Memory Management Lua - Tables as Stacks Lua - Tables as Queues Lua - Sparse Tables Lua Lists Lua - Lists Lua - Inserting Elements into Lists Lua - Removing Elements from Lists Lua - Iterating Over Lists Lua - Reverse Iterating Over Lists Lua - Accessing List Elements Lua - Modifying List Elements Lua - List Length Lua - Concatenate Lists Lua - Slicing Lists Lua - Sorting Lists Lua - Reversing Lists Lua - Searching in Lists Lua - Shuffling List Lua - Multi-dimensional Lists Lua - Sparse Lists Lua - Lists as Stacks Lua - Lists as Queues Lua - Functional Operations on Lists Lua - Immutable Lists Lua - List Serialization Lua - Metatables with Lists Lua Modules Lua - Modules Lua - Returning Functions from Modules Lua - Returning Functions Table from Modules Lua - Module Scope Lua - SubModule Lua - Module Caching Lua - Custom Module Loaders Lua - Namespaces Lua - Singleton Modules Lua - Sharing State Between Modules Lua - Module Versioning Lua Metatables Lua - Metatables Lua - Chaining Metatables Lua - Proxy Tables with Metatables Lua - Use Cases for Proxy Table Lua - Delegation and Tracing via Proxy Tables Lua - Metatables vs Metamethods Lua - Fallback Mechanisms in Metatables Lua - Fallback Cases for Indexing Metamethods Lua - Fallback Cases for Arithmetic and Comparison Metamethods Lua - Fallback Cases for Other Metamethods Lua - Customizing Behavior with Metatables Lua - Controlling Table Access Lua - Overloading Operators Lua - Customizing Comparisons Lua - Making a Table Callable Lua - Customizing String Representation Lua - Controlling Metatable Access Lua Coroutines Lua - Coroutines Lua - Coroutine Lifecycle Lua - Communication Between Coroutines Lua - Coroutines vs Threads Lua - Chaining Coroutines Lua - Chaining Coroutines With Scheduler Lua - Chaining Coroutines Using Queues Lua - Coroutine Control Flow Lua - Nested Coroutines Lua File Handling Lua - File I/O Lua - Opening Files Lua - Modes for File Access Lua - Reading Files Lua - Writing Files Lua - Closing Files Lua - Renaming Files Lua - Deleting Files Lua - File Buffers and Flushing Lua - Reading Files Line by Line Lua - Binary File Handling Lua - File Positioning Lua - Appending to Files Lua - Error Handling in File Operations Lua - Checking if File exists Lua - Checking if File is Readable Lua - Checking if File is Writable Lua - Checking if File is ReadOnly Lua - File Descriptors Lua - Creating Temporary Files Lua - File Iterators Lua - Working with Large Files Lua Advanced Lua - Error Handling Lua - Debugging Lua - Garbage Collection Lua - Object Oriented Lua - Web Programming Lua - Database Access Lua - Game Programing Sorting Algorithms Lua - Bubble Sort Lua - Insertion Sort Lua - Selection Sort Lua - Merge Sort Lua - Quick Sort Searching Algorithms Lua - Linear Search Lua - Binary Search Lua - Jump Search Lua - Interpolation Search Regular Expression Lua - Pattern Matching Lua - string.find() method Lua - string.gmatch() method Lua - string.gsub() method Lua Libraries Lua - Standard Libraries Lua - Math Library Lua - Operating System Facilities Lua Useful Resources Lua - Quick Guide Lua - Useful Resources Lua - Discussion Selected Reading UPSC IAS Exams Notes Developer's Best Practices Questions and Answers Online Resume Builder HR Interview Questions Computer Glossary Who is Who Home Lua Lua Tutorial Job Search PDF Version Quick Guide Resources Discussion This Lua tutorial lets you explore a new language, Lua. This tutorial has everything from fundamentals of the programming language to advanced concepts. After completing this tutorial, you will find yourself good with programming using Lua. What is Lua? Lua is an open source language built on top of C programming language. It is exclusively designed for embedded systems. It features dynamic typing, simple syntax and efficient memory management. Lua has its value across multiple platforms ranging from large server systems to small mobile applications. The name "Lua" means 'Moon' in Portuguese. We should write as "Lua" not "LUA" because LUA can have different meanings for different people and confusing also. Why Choose Lua? Lua is free open-source software, known especially for game development. Some key features which makes Lua a popular choice are − Syntax of Lua is simple and minimal which makes it easy to learn. Lua uses dynamic typing, where we can assign any value to a variable without explicit type declaration. Lua can integrate with other programming languages and systems, which is used in multi-language projects. Lua is fast in terms of performance. Lua is portable i.e, runs perfectly on all platforms that has a standard C compiler like embedded processors, mobile devices and windows. Jobs & Opportunities Well , learning only Lua wouldn't help you get any job but Lua is quite an important tool to be skilled in if an individual is looking for these jobs − Game Developers Embedded systems developer Gameplay Programmer Software Developer Lua- Scripted video games Lua programming language is popularly used for scripting video games, as it relatively eases the process of embedding and deploying. Some notable games that use Lua are − World of Warcraft ROBLOX Angry Birds Lua "Hello, World!" To start with Lua programming, the very basic program is to print "Hello, World!". You can use the print() function. Below is an example of Lua code to print "Hello, World!" − -- Lua code to print "Hello, World!" print ("Hello, World!") Lua Online Compiler Our Lua programming tutorial provides various examples to explain different concepts. We have provided Online Lua Compiler/Interpreter. You can Edit and Execute almost all the examples directly from your browser without the need to set up your development environment. Try to click the icon to run the following Lua code to print conventional "Hello, World!". Below code box allows you to change the value of the code. Try to change the value inside print() and run it again to verify the result. main.lua -- This is my first Lua program. -- This will print 'Hello, World!' as the output print ("Hello, World!"); Prerequisites to Learn Lua You don't have to know a lot of Prerequisites to learn Lua. However, knowledge on fundamental topics would make the process easy. Understanding basic programming concepts, scripting concepts and development environment would help even if you are a total beginner. Additionally, start the learning process with tutorials and explore sample codes. Who Should Learn Lua? This tutorial 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. Frequently Asked Questions about Lua There are some important frequently asked questions (FAQs) about Lua, this section lists them down along with their answers briefly − What is Lua and where is it commonly used? Lua is a lightweight, embeddable scripting language. It's often used in game development, web applications, embedded systems, and as a configuration language. Is Lua object-oriented? Lua supports object-oriented programming through tables and metatables, but it doesn't have classes in the traditional sense. Is Lua a compiled or interpreted language? Lua is typically interpreted, but it can also be compiled into bytecode for performance optimization. What are the basic data types in Lua? Lua supports numbers, strings, booleans, nil, tables, functions, and userdata. What is the role of metatables in Lua? Metatables allow you to customize the behavior of Lua tables, enabling features like operator overloading and metamethods. Why is Lua popular in game development? Lua's simplicity, fast execution, and embeddability make it a suitable choice for scripting game logic, AI, and user interfaces. What are some popular game engines that use Lua? Unity, Roblox, and World of Warcraft are notable examples of game engines that utilize Lua. How does Lua compare to other scripting languages in terms of performance? Lua is generally considered a fast scripting language, often outperforming other scripting languages in benchmarks. How can I get started with Lua? Follow this tutorial chapter-wise for a complete understanding about Lua programming. Start Lua by installing Lua, writing basic scripts, and exploring its core concepts like variables, data types, control flow, and functions. Print Page Previous Next Advertisements ABOUT US OUR TEAM CAREERS JOBS CONTACT US TERMS OF USE PRIVACY POLICY REFUND POLICY COOKIES POLICY FAQ'S Tutorials Point is a leading Ed Tech company striving to provide the best learning material on technical and non-technical subjects. Copyright 2026. All Rights Reserved.