Lua

ethan on 2004-06-15T07:10:37

A few days ago I had the bright idea of writing an Inline module, just because I was curious how that would work. I chose a language that came to my mind quite spontaneously, partly because I remembered vaguely that it was a language meant to be embedded into other applications.

What I've seen so far of Lua is extremely impressive. The language is extremely clean and, despite offering only a handful of features and concept, very powerful. Some interesting things have been integrated into it quite well, such as coroutines and closures. The latter makes it feel a bit like a functional programming language with the very nice touch of an imperative syntax. It's even object-oriented.

Its C API is a bit confusing for me as of now. That is probably because I haven't yet written a single program in this language. But the Inline stuff already works quite well for some of the basic Lua/Perl types. The nice thing about Lua is that its types map quite well onto Perl. It knows about functions as a data type so a little bit of currying looks like this:

function foo (a)
    return function (b) return a * b end
end

io.write( foo(5)(3) )


Very neat! I have already some ideas how the inlined Lua functions can return Lua closures back to Perl as in

use Inline Lua;

print foo(5)->(3); __END__ __Lua__ function foo (a) return function (b) return a * b end end


Lua on the Scriptometer

jonasbn on 2004-06-15T07:56:34

Just our of curiosity and never having heard of Lua before I checked it out on the scriptometer, mentioned by Gnat on use.perl.

It actually does quite well, with an overall score of 90 compared to Perl's 149

Re:Lua on the Scriptometer

ethan on 2004-06-15T08:55:30

It actually does quite well, with an overall score of 90 compared to Perl's 149

Yes, I also noticed this on the scriptometer. And one has to keep in mind that Lua is not even meant as a standalone language. It is intended to be fleshed out with customly defined C functions to provide additional functionality.

This comparison made me stick to Lua. I was on the edge of dropping Inline::Lua again when things didn't work at all in the beginning. But then I saw that Lua appears to be quite performant for some tasks and so I gave it another try, luckily so.

Lua in 2002

rafael on 2004-06-15T08:19:25

The first time I heard about Lua was when I participated in the redaction of The Year In Scripting Languages 2002. Lots of links there. It looks like a not well-known language but with a small and dynamic community.

Re:Lua in 2002

ethan on 2004-06-15T09:16:23

This is probably due to the niche it fills. There appears to be no Lua newsgroup, only one mailinglist to which I had to subscribe to get some help yesterday. The list is active and the replies I got were prompt and competent.

I haven't yet grokked the 'social structure' of this list but it appears that Lua's developers are there, too. It's odd in that both the people using Lua as a programming language and those more concerned with embedding Lua (and thus focussing on Lua's C API) can be found on the same mailinglist. From the tone and level of the list I conclude that its community might be one of Lua's strong points.