Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Lua Environment Installation

Lua Environment Installation

Installing on Linux

Installing Lua on Linux & Mac is very simple; you only need to download the source package and decompress and compile it in the terminal. This article uses version 5.4.7 for installation:

Installing from source

Download the source code to install:


curl -L -R -O https://www.lua.org/ftp/lua-5.4.7.tar.gz
tar zxf lua-5.4.7.tar.gz
cd lua-5.4.7
make all test
make install

Installing via the Package Manager

Debian/Ubuntu system:


sudo apt update
sudo apt install lua5.3

CentOS/RHEL system:

sudo yum install epel-release
sudo yum install lua

Install on Mac OS X

Installing from source

Download the source code to install:


curl -L -R -O https://www.lua.org/ftp/lua-5.4.7.tar.gz
tar zxf lua-5.4.7.tar.gz
cd lua-5.4.7
make all test
make install

Homebrew

Install using Homebrew:


brew install lua

Testing

Next we create a HelloWorld.lua file, with the following code:


print("Hello World!")

Execute the following command:


$ lua HelloWorld.lua

The output is:

Hello World!

Install Lua on the Window system

Under window you can use an IDE environment called "SciTE" to run lua programs. The download address is:

After double-clicking to install, you can write and run Lua programs in this environment.