</>
CodeLearn Pro
Start Learning Free →
Lua scripting language background
Scripting & Shell · Game Development · Embeddable

Learn Lua

Lua is the world's most popular embedded scripting language. It powers Roblox, World of Warcraft addons, Redis, Nginx and countless games. Tiny, fast, elegant — and one of the most satisfying languages to write.

🎮
Game Scripting
Powers Roblox, World of Warcraft addons and more
Tiny & Fast
Under 300KB — the lightest scripting language
🔌
Embeddable
Embeds into C/C++ apps in minutes
📦
Simple Syntax
Clean, readable code with no semicolons needed

Lua at a Glance

No semicolons. No type declarations. Tables do everything. Clean and direct.

Variables & Print.lua
-- Variables (local is best practice)
local name = "Alice"
local score = 95
local active = true

print("Hello, " .. name .. "!")
print("Score:", score)
print("Active:", active)

▶ Output

Hello, Alice!
Score:	95
Active:	true
Tables (Arrays & Maps).lua
-- Table as array
local fruits = {"apple", "banana", "cherry"}
print(fruits[1])          -- Lua index starts at 1!
print(#fruits)            -- Length: 3

-- Table as dictionary
local student = {
    name = "Alice",
    score = 95,
}
print(student.name)
print(student["score"])

▶ Output

apple
3
Alice
95
Functions.lua
-- Multiple return values!
local function minMax(t)
    local min, max = t[1], t[1]
    for _, v in ipairs(t) do
        if v < min then min = v end
        if v > max then max = v end
    end
    return min, max
end

local lo, hi = minMax({4, 7, 1, 9, 3})
print("Min:", lo, "Max:", hi)

▶ Output

Min:	1	Max:	9
Scripting & Shell category
🔧 Scripting & Shell

Explore the Scripting category

Lua is the most popular embedded scripting language. Also explore Bash for terminal automation and PowerShell for Windows scripting.

Frequently Asked Questions

What is Lua used for?

Lua is used extensively for game scripting (Roblox, World of Warcraft, LÖVE 2D), embedded scripting in applications (Redis, Nginx/OpenResty, VLC), and as a lightweight configuration language. It is one of the most widely embedded scripting languages in the world.

Is Lua a good first language?

Lua is beginner-friendly with a very clean, minimal syntax — no semicolons, simple keywords, and very few special rules. If you are interested in game development (especially Roblox), Lua is an excellent starting point. For general programming, Python is more commonly recommended first.

How is Lua different from Python?

Lua is much smaller (the entire interpreter is under 300KB), starts up almost instantly, and is designed to be embedded inside other programs. Python has a vastly larger standard library and ecosystem. Lua uses tables for everything (arrays, dictionaries, objects), while Python has distinct list, dict, and class types.

What should I learn after Lua basics?

If you are using Lua for games, explore the LÖVE 2D framework for desktop games or dive deeper into Roblox Studio. For server scripting, look at OpenResty (Lua in Nginx). If you want to go deeper into the language, study metatables and the Lua C API for embedding.

Ready to write your first Lua script?

Free. No signup. No downloads. Just start.

Start Learning Lua

No account required · Always free

The Story of Lua

Real history, real companies, and an honest look at where Luashines and where it doesn't — not just a feature list.

🕰️

Where it came from

Lua was created in Brazil in 1993 by Roberto Ierusalimschy, Luiz Henrique de Figueiredo and Waldemar Celes at PUC-Rio, designed from the outset to be small, fast, and easy to embed inside other applications written in C — rather than to be used as a stand-alone language on its own, which is a genuinely different design goal from most languages on this list.

🏢

How it’s actually used today

Lua is the scripting language behind Roblox — meaning millions of young developers have written their first lines of code in Lua without necessarily knowing it — and it's used for modding in games like World of Warcraft and Garry's Mod. Adobe Photoshop Lightroom and various network routers and embedded devices also use Lua internally for lightweight scripting.

⚖️

Strengths & trade-offs

Lua's tiny footprint and speed make it ideal for embedding inside a larger application (a game engine, a piece of hardware) where you need scripting without the overhead of a full language runtime. It's not designed to be a general-purpose, stand-alone application language the way Python or JavaScript are, so you won't typically build a whole web app or CLI tool in it alone.

🧭

What to learn next

If your interest is specifically Roblox or game modding, Lua is genuinely enough on its own to get productive quickly. For general-purpose scripting beyond a specific game engine or embedded tool, Python or Bash cover far more ground.