Logo
  • Ubuntu
  • CentOS
  • Debian
  • Fedora
  • RedHat

How to Install Lua Scripting Language in Linux - DesignLinux

Sep 26 2022
designlinux 0 Comments

Lua is a free and open-source, powerful, robust, minimal, and embeddable scripting language. It’s extensible and interpreted scripting language that is dynamically typed, and run by interpreting bytecode with a register-based virtual machine.

Lua runs on all if not most Unix-like operating systems including Linux and Windows; on mobile operating systems (Android, iOS, BREW, Symbian, Windows Phone); on embedded microprocessors (ARM and Rabbit); on IBM mainframes, and many more.

See how Lua programs work in the live demo.

Lua Features:

  • Builds on all systems with a standard C compiler.
  • It’s remarkably lightweight, fast, efficient, and portable.
  • It’s easy to learn and use.
  • It has a simple and well-documented API.
  • It supports several types of programming (such as procedural, object-oriented, functional, and data-driven programming as well as data description).
  • Implements object-oriented via meta-mechanisms.
  • It also brings together straightforward procedural syntax with formidable data description constructs rooted around associative arrays and extensible semantics.
  • Comes with automatic memory management with incremental garbage collection (thus making it perfect for real-world configuration, scripting, and also breakneck prototyping).

How to Install Lua in Linux

Lua package is available in official repositories of major Linux distributions, you can install the latest version using the appropriate package manager on your system.

------- On Debian, Ubuntu & Mint ------- 
$ sudo apt install lua5.3

------- On RHEL, CentOS, Rocky & AlmaLinux ------- 
# yum install epel-release
# yum install lua

------- On Fedora Linux ------- 
# dnf install lua

Note: The current version of the Lua package in the EPEL repository is a little older, therefore to install the latest release, you need to build and install it from the source as explained below.

Install Lua from Sources

First, ensure that you have development tools installed on your system, otherwise, run the command below to install them.

------- On Debian, Ubuntu & Mint ------- 
$ sudo apt install build-essential libreadline-dev

------- On RHEL, CentOS, Rocky & AlmaLinux and Fedora ------- 
# yum groupinstall "Development Tools" 
# yum install readline readline-devel

Then to build and install the latest release (version 5.4.4 at the time of this writing) of Lua, you need to download the lua source file or run the following commands to download the package tarball, extract, build and install it.

$ mkdir lua_build
$ cd lua_build
$ curl -R -O http://www.lua.org/ftp/lua-5.4.4.tar.gz
$ tar zxf lua-5.4.4.tar.gz
$ cd lua-5.4.4
$ make linux test
$ sudo make install

Once you have installed it, run Lua interpretor as shown.

$ lua 

Lua 5.4.4  Copyright (C) 1994-2022 Lua.org, PUC-Rio
>

Using your favorite text editor, you can create your first Lua program as follows.

$ vi hello.lua

And add the following code to the file.

print("Hello World")
print("This is Tecmint.com and we are testing Lua")

Save and close the file. Then run your program as shown.

$ lua hello.lua
Run Lua Program
Run Lua Program

For more information and to learn how to write Lua programs, go to: https://www.lua.org/home.html

Lua is a versatile programming language being used in numerous industries (from the web to gaming to image processing and beyond), and it’s designed with a high priority for embedded systems.

If you encounter any errors during installation or simply want to know more, use the comment form below to send us your thoughts.

Related

Tags: Lua Programming Language

10 Most Dangerous Commands – You Should Never Execute on Linux

Prev Post

Enable Debugging Mode in SSH to Troubleshoot Connectivity Issues

Next Post
Archives
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • July 2022
  • June 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
Categories
  • AlmaLinux
  • Android
  • Ansible
  • Apache
  • Arch Linux
  • AWS
  • Backups
  • Bash Shell
  • Bodhi Linux
  • CentOS
  • CentOS Stream
  • Chef
  • Cloud Software
  • CMS
  • Commandline Tools
  • Control Panels
  • CouchDB
  • Data Recovery Tools
  • Databases
  • Debian
  • Deepin Linux
  • Desktops
  • Development Tools
  • Docker
  • Download Managers
  • Drupal
  • Editors
  • Elementary OS
  • Encryption Tools
  • Fedora
  • Firewalls
  • FreeBSD
  • FTP
  • GIMP
  • Git
  • Hadoop
  • HAProxy
  • Java
  • Jenkins
  • Joomla
  • Kali Linux
  • KDE
  • Kubernetes
  • KVM
  • Laravel
  • Let's Encrypt
  • LFCA
  • Linux Certifications
  • Linux Commands
  • Linux Desktop
  • Linux Distros
  • Linux IDE
  • Linux Mint
  • Linux Talks
  • Lubuntu
  • LXC
  • Mail Server
  • Manjaro
  • MariaDB
  • MongoDB
  • Monitoring Tools
  • MySQL
  • Network
  • Networking Commands
  • NFS
  • Nginx
  • Nodejs
  • NTP
  • Open Source
  • OpenSUSE
  • Oracle Linux
  • Package Managers
  • Pentoo
  • PHP
  • Podman
  • Postfix Mail Server
  • PostgreSQL
  • Python
  • Questions
  • RedHat
  • Redis Server
  • Rocky Linux
  • Security
  • Shell Scripting
  • SQLite
  • SSH
  • Storage
  • Suse
  • Terminals
  • Text Editors
  • Top Tools
  • Torrent Clients
  • Tutorial
  • Ubuntu
  • Udemy Courses
  • Uncategorized
  • VirtualBox
  • Virtualization
  • VMware
  • VPN
  • VSCode Editor
  • Web Browsers
  • Web Design
  • Web Hosting
  • Web Servers
  • Webmin
  • Windows
  • Windows Subsystem
  • WordPress
  • Zabbix
  • Zentyal
  • Zorin OS
Visits
  • 0
  • 256
  • 614,628

DesignLinux.com © All rights reserved

Go to mobile version