How to Install Lua Scripting Language in Linux

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Aaron Kili

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

12 Responses

  1. Brainstorms says:

    For those who need a Windows solution, I found a good source that installs Lua 5.1, 5.2, and 5.3, plus LuaRocks for all three. It’s current, and actively maintained. It’s called “Multi-Lua for Windows” and can be found on GitHub: https://github.com/Tieske/luawinmulti

    You’ll need to install a C compiler, such as MinGW, as this project compiles everything from source, Lua and Luarocks alike.

    Rather than running a Lua interpreter in its own shell window, this Lua runs in the built-in Windows Command Shell window.

  2. Brainstorms says:

    Suggestion: After installing Lua, install “LuaRocks“, which is Lua’s package repository (similar to CPAN for Perl and PyPI for Python).

    Lua was designed to be embedded and extensible, so it depends on external libraries for a number of important functions that are internal to most other languages. This includes libraries for working with the host file system, for socket I/O (networking), etc., plus things like unit testing, logging, and so forth.

    Lua’s repo packages are called “rocks” (Lua rocksMoon rocks… get it?), so you can search for, install, update your “rocks” using LuaRocks. LuaRocks installs separate local package caches for each Lua version.

    Lua rocks are typically coded in C, so they need to be compiled from source by LuaRocks in order to be installed. This is usually not an issue for Linux hosts, but for Windows installations you’ll need to have a C compiler installed. I use MinGW for this on my Win platforms.

    Finally, there are two ways to install LuaRocks. I suggest the “bootstrapping” method, which installs LuaRocks as a Lua rock. The advantage of this method is that LuaRocks can be updated in the future by asking LuaRocks to update itself: “luarocks install luarocks“.

  3. Benji says:

    This is what worked for me on Linux Mint 19:

    $ mkdir lua_build
    $ cd lua_build
    $ wget http://www.lua.org/ftp/lua-5.3.4.tar.gz
    $ sudo tar -zxf lua-5.3.4.tar.gz
    $ cd lua-5.3.4
    $ sudo make linux test
    $ sudo make install
    
    • Ravi Saive says:

      @Benji,

      Thanks for sharing the instructions, hope it will help Mint users..

    • Brainstorms says:

      Did you need Lua 5.3.4 for a particular reason? Linuxmint 19 is based on Ubuntu Bionic, which has Lua 5.0, 5.1, 5.2, and 5.3 in its repositories. The repo version for 5.3 is 5.3.3, however. Is there a significant fix for 5.3.4?

  4. Leema Singh says:

    I want to know how to do ssh with lua to a remote server and run tcpdump command process in background on remote server.

  5. Brainstorms says:

    More Lua features: full lexical closures, co-routines, and multiple return values. There are only 8 data types: nil, Number, String, Boolean, Table, Userdata, Function, and Thread. Any type can be assigned to a variable, and all types are first-class.

    All structured data is made from Tables (associative arrays). Data types and instances of Table/Userdata can have “meta-Tables” that provide powerful extensibility (including object-oriented structure & behavior). Has a very nice C API which helps make it both embeddable and extensible. Nearly a linguistically/semantically perfect language…

  6. Jeff says:

    I use devilspie2 to embed various things like terminals, browsers, or media players into my desktop, and devilspie uses Lua for configuration. Straight forward and great documentation.

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.