› Forums › Lua › Getting Started with Lua on Windows 10: From Downloading the Wrong Package to Running Your First Program
- This topic is empty.
-
AuthorPosts
-
June 9, 2026 at 2:36 am #6849
Lua is one of the simplest and most elegant programming languages to learn. However, even before writing the first line of code, beginners often face challenges related to installation, choosing the correct download, extracting files, and understanding how to run programs.
This learning post documents the complete journey of setting up Lua on a Windows 10 laptop, including the mistakes encountered and how they were resolved.
Why Learn Lua?
Lua is a lightweight scripting language designed to be:
- Easy to learn
- Fast and efficient
- Embeddable in applications
- Cross-platform
Lua is used in:
- Game development
- Embedded systems
- Network devices
- Text editors
- Application scripting
A traditional first program in Lua is:
print("Hello World")
The Initial Goal
The objective was to begin learning Lua using the book Programming in Lua, starting with Chapter 1:
print("Hello World")and later progressing to the recursive factorial example:
function fact(n) if n == 0 then return 1 else return n * fact(n - 1) end endBefore running these examples, Lua needed to be installed.
Issue #1: Downloading the Wrong Package
The first download selected was:
lua-5.5.0_Sources.tar.gzThis seemed reasonable because it was prominently listed on the download page.
However, this package contains:
- Lua source code
- Makefiles
- Files intended for developers building Lua itself
It does not contain ready-to-run Windows executables.
Understanding Source Code vs Executables
There are two common types of software downloads.
Source Code
Source code contains human-readable program files.
Example:
lua-5.5.0_Sources.tar.gzThese files must be compiled before use.
Typical contents include:
src README Makefile
Executables
Executable packages contain programs ready to run.
Example:
lua-5.5.0_Win32_bin.zipor
lua-5.5.0_Win64_bin.zipThese contain:
lua55.exe luac55.exe lua55.dllwhich can be executed immediately.
Issue #2: Windows Could Not Open the File


After downloading the source package, Windows displayed:
How do you want to open this file?The file type was:
.gzThis happened because:
.tar.gzis a compressed archive format commonly used on Linux and Unix systems.
Windows does not always have built-in support for these archives.
Understanding .gz Files
A file such as:
lua-5.5.0_Sources.tar.gzcontains two layers:
First:
.tarwhich is an archive.
Second:
.gzwhich compresses the archive.
To access the contents:
- Extract the
.gz - Extract the resulting
.tar
Tools such as 7-Zip can perform these operations.
Choosing the Correct Download
The LuaBinaries page offered several choices.
Among them:
lua-5.5.0_Win32_bin.zipWindows x86 executables
and
lua-5.5.0_Win64_bin.zipWindows x64 executables
The executable package is the correct choice for beginners.
Issue #3: Determining Which Version to Download
The laptop specifications were checked.
The machine had:
Intel Core i5-6300U 8 GB RAM Windows 10Such hardware normally supports:
64-bit WindowsTherefore:
lua-5.5.0_Win64_bin.zipwould usually be preferred.
However, downloading:
lua-5.5.0_Win32_bin.zipalso works because 32-bit applications can run on 64-bit Windows.
Successfully Extracting Lua

After extracting the binary package, the folder contained:
lua55.dll lua55 luac55 wlua55Each file serves a different purpose.
lua55
The Lua interpreter.
This program executes Lua code.
luac55
The Lua compiler.
It converts Lua programs into Lua bytecode.
wlua55
A Windows version of Lua that runs without a console window.
Useful for GUI-based applications.
lua55.dll
The dynamic library used by Lua programs.
Issue #4: Where Do Commands Get Typed?
A common beginner question appeared:
Where do I type the command?
The answer is:
Not in File Explorer.
Instead:
- Open the folder containing Lua.
- Click the address bar.
- Type:
cmd- Press Enter.
Windows opens Command Prompt directly inside that folder.
Opening the Lua Interpreter
Inside Command Prompt:
lua55was entered.
Output:
Lua 5.5.0 >The symbol:
>is Lua’s interactive prompt.
Similar to Python’s:
>>>
First Successful Lua Program
At the prompt:
print("Hello World")Output:
Hello WorldSuccess!
The first Lua program had run correctly.
Understanding print()
The function:
print()displays output.
Example:
print("Lua")Output:
Lua
Experimenting with Numbers
Lua can immediately perform arithmetic.
Example:
print(2 + 3)Output:
5
Variables in Lua
Variables store values.
Example:
x = 10 print(x)Output:
10This looks almost identical to Python:
x = 10 print(x)
Strings in Lua
Strings are sequences of characters.
Example:
name = "Rajeev" print(name)Output:
Rajeev
Functions in Lua
Functions group reusable code.
Example:
function square(n) return n * n endTesting:
print(square(5))Output:
25
Understanding end
Lua uses:
endto terminate blocks.
Example:
if x > 5 then print("Large") endUnlike Python, Lua does not rely on indentation.
Python:
if x > 5: print("Large")Lua:
if x > 5 then print("Large") end
The Recursive Factorial Example
One of the first examples from Programming in Lua is:
function fact(n) if n == 0 then return 1 else return n * fact(n - 1) end endTesting:
print(fact(5))Output:
120
How the Recursion Works
The call:
fact(5)expands into:
5 × fact(4) 5 × 4 × fact(3) 5 × 4 × 3 × fact(2) 5 × 4 × 3 × 2 × fact(1) 5 × 4 × 3 × 2 × 1 × fact(0)Base case:
fact(0)returns:
1Therefore:
5 × 4 × 3 × 2 × 1 = 120
Creating Lua Files
Interactive mode is useful for experimentation.
Real programs are saved in files.
Example:
hello.luaContents:
print("Hello World") print("I am learning Lua") print(2 + 3)Run using:
lua55 hello.luaOutput:
Hello World I am learning Lua 5
Key Lessons Learned
- Source code packages are not the same as executable packages.
.tar.gzarchives usually contain source code.- Beginners should download executable binaries.
- Lua programs are executed using the Lua interpreter.
- The Lua prompt (
>) works similarly to Python’s interactive shell. - Lua uses
endto terminate code blocks. - Functions, variables, strings, and arithmetic are easy to learn.
- The first successful Lua program is often:
print("Hello World")- Recursive functions such as factorial demonstrate the power of Lua.
- Command Prompt is used to run Lua programs from files.
Next Learning Topics
After successfully running Lua, the recommended learning sequence is:
- Variables and data types
- Arithmetic operators
- Strings
- Conditional statements
- Loops
- Functions
- Recursion
- Tables (Lua’s most important feature)
- Modules using
require - File handling
- Building a CSV reader
- Small command-line projects
With Lua installed and working, the learning journey can now move beyond setup and into programming itself.
-
AuthorPosts
- You must be logged in to reply to this topic.
