Why Lua is the best scripting/configuration language

Lua is a minimalistic, simplistic, extendable, portable, speedy, scripting language.

It can preform the same things as Python, but way more efficently and simplisticly.

I believe it should replace Python. It does everything better.

Here’s my experience with Python.

I got into coding through C & Python3.

I practiced through my first editor, Emacs.

And I’ve made things with multiple libraries, parsers, et cetera.

I understand Python.

Lua vs Python

Lua does a number of things better than Python.

Here’s a list of things:

Speed

Python is painfully slow. It’s one of the slowest languages ever!

But, Lua is on the other side of the spectrum.

It is deemed as the fastest interpreted language out there.

Better syntax

Lua carries such simple and easy to understand syntax, It’s great!

However, Python has sub par syntax. It can be confusing sometimes.

Here’s an example of syntax:

Python:

from os import system

def func():
  print("Hello!")

if 1 == 1:
  if 2 == 2:
    if 3 == 3:
      if 4 == 4:
        system("ls")

Lua:

execute = require('os').execute

function func()
  print("Hello!")
end

if 1 == 1 then
  if 2 == 2 then
    if 3 == 3 then
      if 4 == 4 then
        execute("ls")
      end
    end
  end
end

Lua has more coherent syntax. By just reading it you can tell what it means.

if (Statement) then

function name()

Additionally, all of these statements end in “end”.

Whilst, Python has a more, unique syntax..

Indentation sucks, no one likes it. Everyone I know whom is subject to Python’s indentation always talks about how bad it is.

Along with “def” for functions? What?

Simplicity

Lua has 26 keywords, Vs. Python’s 35.

Lua only has tables rather than Python’s lists, tuples, sets, and dictionaries.

And a table is way more powerful than all of Python’s data storage tools.

Vs. Lists/Sets

It can literally do everything that both of these can, without the complexity.

Vs. Tuples

Read only variables

Vs. Dictionaries

Sense you can hold tables within tables, you can have this:

table1 = {
  ["Apple"] = "Tasty",
  ["Pineapple"] = "Tasty"
  ["Lemon"] = "Sour"
}

table2 = {
  {"Apple", "Tasty"},
  {"Pineapple", "Tasty"},
  {"Lemon", "Tasty"}
}

table2 = {
  fruits = {
    Apple = "Tasty",
    Pineapple = "Tasty",
    Lemon = "Tasty"
  }
}

What’s shown above is true power compared to Python’s stupid “no-duplicates vs duplicates” lists & sets whatever.

As a configuration language

Lua is a fantastic choice for a scripting language.

Ever heard of AwesomeWM?

It’s known as one of the most powerful window managers of all time because of it’s Lua configuration language.

Or NeoVim? Known as the successor to Vim? Powerful in so many more ways.

Package manager

Okay, Python’s package manager, Pip.

It’s god awful.

It’s hard to use, popular distributions disable it like Archlinux or Debian GNU/Linux, and doesn’t make sense.

Cargo, is how you make Pip’s philosophy good.

You can use cargo with ease.

You cannot with Pip.

Luarocks is more of a traditional package manager. You either, install to system directories, or local directories.

Lua’s own PATH with detect either, and run them when asked.

That’s it. Nothing else. No other rubbish.

And plus, sense Lua has close connections to C, Lua packages and have some C code in them too.

Overall

Lua (in my opinion of course) is better than Python.

It’s just a better experience using.

And I’d have it no other way.