23 comments

[ 644 ms ] story [ 959 ms ] thread
Lua is the SQLite of program languages, absolutely blast
Wish there is newer LuaJIT to leverage the new Lua features, but then maybe those new features are not really that critical.
Agree, especially because it'd be nice for projects that use LuaJIT if you could swap the versions as needed.
It is interesting that so many of the largest languages were developed in a couple year time frame in the early-mid 90s. Python, Javascript, Java, Lua, R. All of these were developed 91-95 and make a bulk of development today.
Java 1996, C++ only got standardized in 1998, C in 1990 (tehcnically the standard is from 1989, but there was a short retification in 1990), Delphi is from 1995 (not that big player nowadays, but plenty of its influences live on C#, Typescript and Kotlin).

It goes to show how much investment is required for a programming language to actually take off at scale.

However in a couple of years, we will be asking the computers to perform tasks for us and the actually compiler frontend will be irrelevant to the AI runtime.

> work has begun on Lua 5.5

A beta version is now available:

https://www.lua.org/work/

The main change from 5.4 seems to be the (optional?) removal of global-by-default, instead requiring declarations for global variables.

My only context in using Lua is my neovim configuration, does any know of any good books or tutorials that make something more advance using only lua? Anything of note to consider/read/watch?
I absolutely love Lua and I especially love when others discover Lua and are about to embark on the amazing journey.

Here, you're gonna need this:

https://www.lua.org/gems/

That's it - I'm building my next startup in Lua!
I believe cloudflare has quite a bit of Lua in some of their products (there's some very good Nginx lua integrations and variants like Openresty).
Here’s my bit of public domain code for iterating through tables in Lua so that the elements are sorted. This routine works like the pairs() function included with Lua:

  -- Like pairs() but sorted
  function sPairs(inTable, sFunc)
    if not sFunc then
      sFunc = function(a, b)
        local ta = type(a)
        local tb = type(b)
        if(ta == tb)
          then return a < b 
        end
        return ta < tb
      end
    end
    local keyList = {}
    local index = 1
    for k,_ in pairs(inTable) do
      table.insert(keyList,k)
    end
    table.sort(keyList, sFunc)
    return function()
      key = keyList[index]
      index = index + 1
      return key, inTable[key]
    end
  end
Example usage of the above function:

  a={z=1,y=2,c=3,w=4}
  for k,v in sPairs(a) do
    print(k,v)
  end
With a sort function:

  a={z=1,y=2,c=3,w=4}
  function revS(a,b)
    return a>b
  end
  for k,v in sPairs(a,revS) do
    print(k,v)
  end
(Yes, this is a lot easier to do in Perl or Python, since those languages unlike Lua have built in list iterators, but it’s possible to do in Lua too)
I was thinking a while back, how nice it would be if lua was the scripting language in the browser instead of javascript. There are some projects to compile lua to wasm and have it run in the browser...

https://pluto-lang.org/web/#env=lua%3A5.4.6&code=if%20_PVERS...

But interoperability with the DOM is the missing key.

Still, if lua was used instead of javascript, I could see myself saying... man, I wonder what browser development would be like if we replaced lua with x.

I don't understand why Python is so popular when there's Lua. It's just so much better. Not as good as Rebol but still much better than Python.
I've been saying it for years: Lua needs its Ruby on Rails moment
For many, Lua is primarily known as the Roblox language. Pretty impressive that it's the language of use in a game (/set of games) with 380 million monthly active players - currently the most popular in the world.
When comparing speed I use simple tests like a loop printing an incremented line number or reading from stdin and printing to stdout. These simple tests are useful for me because, when combined with pattern matching or regular expressions, simple I/O tasks like these are actually what I use a "memory safe" language for

dino is slightly faster than lua (not luajit)

but spitbol is actually faster than lua, dino and luajit

ngn k is slightly faster than spitbol but lacks built-in pattern matching or RE

FWIW, I do not use a terminal emulator. I only use textmode No graphics layer. No "desktop"

If you're new to Lua, be sure to check out TurboLua:

https://turbo.readthedocs.io/en/latest/

Its a very flexible way to do realtime/embedded, performance-critical services (e.g., a game server or API gateway) where Lua's speed and low overhead matter.

(comment deleted)