- Getting Ready to Learn Lua Step-By-Step
- Learning Lua Step-By-Step (Part 11)
- Learning Lua Step-By-Step (Part 14)
- Learning Lua Step-By=Step
- Learning Lua Step-By-Step (Part 2)
- Learning Lua Step-By-Step (Part 3)
- Learning Lua Step-By-Step (Part 4)
- Learning Lua Step-By-Step (Part 5)
- Learning Lua Step-By-Step (Part 6)
- Learning Lua Step-By-Step (Part 7)
- Learning Lua Step-By-Step (Part 8)
- Learning Lua Step-By-Step (Part 9): Exploring Metatables and Operator Overloading
- Learning Lua Step-By-Step (Part 10)
- Learning Lua Step-By-Step: Part 12
- Learning Lua Step-By-Step (Part 13)
- Learning Lua Step-By-Step (Part 15)
- Learning Lua Step-By-Step (Part 16)
- Learning Lua Step-By-Step (Part 17)
- Learning Lua Step-By-Step (Part 18)
- Learning Lua Step-By-Step (Part 19)
- Learning Lua Step-By-Step: (Part 20) Memory Management
- Learning Lua Step-By-Step: (Part 21)
- Learning Lua Step-By-Step: (Part 22)
- Learning Lua Step-By-Step: (Part 23)
- Learning Lua Step-By-Step: (Part 24)
Post Stastics
- This post has 873 words.
- Estimated read time is 4.16 minute(s).
This article is part of the Learning Lua Step-By-Step series. It covers the basics of setting up your Lua development environment and toolchain. This includes creating a "projects" directory and installing Git, Lua, and ZeroBrane Studio IDE (Integrated Development Environment) you will use for writing your Lua programs.
Note that the only required software is Lua itself. You can use Notepad on Windows, Text Pad on Mac, and Nano or GEdit on Linux. Or for that matter any Text editor you like. However, you cannot use a document editor like Microsoft Word or MS Office, Open Office, etc. These document editors place hidden formatting and control codes in your text. Lua (and almost all programming languages) will misinterpret this hidden data and it will cause errors in your programs. So only use an IDE or Text Editor for writing code!
If you want to use the setup I am using to write the tutorial series, then follow each step below. If you want a minimal setup and plan to use your favorite text editor or compatible IDE you already have installed, then skip to installing Lua. At the time of this writing, Lua 5.4 is the most recent. But any 5.x version should be fine.
Installing Git, Lua, and ZeroBrane Studio
Windows
- Install Git:
- Go to the official Git website: https://git-scm.com/downloads
- Click on the "Download" button and select the Windows version.
- Run the downloaded installer and follow the on-screen instructions to complete the installation.
- Install Lua:
- Go to the official Lua website: https://www.lua.org/download.html
- Scroll down to the "Lua for Windows" section and click on the latest version.
- Run the downloaded installer and follow the on-screen instructions to complete the installation.
- Create the Projects Directory:
- Open File Explorer and navigate to your user directory (e.g.,
C:\Users\YourUsername
). - Create a new folder called
projects
. - Inside the
projects
folder, create another folder calledLua
. - Inside the
Lua
folder, create a final folder calledtutorial
. - This directory structure (
projects/Lua/tutorial
) will be your dedicated Lua project directory.
- Install ZeroBrane Studio:
- Open a Git Bash or Command Prompt window.
- Navigate to the C:\
Program Files\Lua\tutorial
directory using thecd
command or File Explorer. - Run the following command to clone the ZeroBrane Studio repository:
git clone https://github.com/pkulchenko/ZeroBraneStudio.git
- Once the cloning process is complete, navigate to the
ZeroBraneStudio
directory:cd ZeroBraneStudio
- To add ZeroBrane Studio to your system PATH, run the following command:
setx PATH "%PATH%;%CD%"
- This will add the current directory (where ZeroBrane Studio is located) to your system's PATH, allowing you to run the
zbstudio
command from any directory.
macOS
- Install Git:
- Open the Terminal application.
- Run the following command to install Git using Homebrew (if you don't have Homebrew installed, you can install it first):
brew install git
- Install Lua:
- Open the Terminal application.
- Run the following command to install Lua using Homebrew:
brew install lua
- Create the Projects Directory:
- Open Finder and navigate to your user directory (e.g.,
/Users/YourUsername
). - Create a new folder called
projects
. - Inside the
projects
folder, create another folder calledLua
. - Inside the
Lua
folder, create a final folder calledtutorial
. - This directory structure (
projects/Lua/tutorial
) will be your dedicated Lua project directory.
- Install ZeroBrane Studio:
- Open the Terminal application.
- Navigate to the
~/
directory using thecd
command. - Run the following command to clone the ZeroBrane Studio repository:
git clone https://github.com/pkulchenko/ZeroBraneStudio.git
- Once the cloning process is complete, navigate to the
ZeroBraneStudio
directory:cd ZeroBraneStudio
- To add ZeroBrane Studio to your user's PATH, run the following command:
echo 'export PATH="$PATH:$HOME/projects/Lua/tutorial/ZeroBraneStudio"' >> ~/.bash_profile
- This will add the current directory (where ZeroBrane Studio is located) to your user's PATH, allowing you to run the
zbstudio
command from any directory. - Restart your terminal for the changes to take effect.
Linux (Ubuntu/Debian-based)
- Install Git:
- Open the Terminal application.
- Run the following command to install Git:
sudo apt-get update sudo apt-get install git
- Install Lua:
- Open the Terminal application.
- Run the following command to install Lua:
sudo apt-get update sudo apt-get install lua5.
4
- Create the Projects Directory:
- Open the Terminal application.
- Run the following commands to create the project directory structure:
cd ~ mkdir -p projects/Lua/tutorial
- This will create the
projects/Lua/tutorial
directory in your user's home directory.
- Install ZeroBrane Studio:
- Open the Terminal application.
- Navigate to the ~/ directory using the
cd
command. - Run the following command to clone the ZeroBrane Studio repository:
git clone https://github.com/pkulchenko/ZeroBraneStudio.git
- Once the cloning process is complete, navigate to the
ZeroBraneStudio
directory:cd ZeroBraneStudio
- To add ZeroBrane Studio to your user's PATH, run the following command:
echo 'export PATH="$PATH:$HOME/projects/Lua/tutorial/ZeroBraneStudio"' >> ~/.bashrc
- This will add the current directory (where ZeroBrane Studio is located) to your user's PATH, allowing you to run the
zbstudio
command from any directory. - Restart your terminal for the changes to take effect.
After completing these steps, you should have Git, Lua, and ZeroBrane Studio installed on your system, and your Lua project directory should be set up as projects/Lua/tutorial
. You can now start using these tools to learn and practice Lua programming.