Check out Lua!

Posted by chrisp Sun, 11 Nov 2007 07:09:00 GMT

The TIOBE index tracks the popularity of programming languages. It’s been around for quite some time now and seems to be a fairly accurate representation of the relative popularity of programming languages.

Very rarely you will see a language from the lower 50 suddenly leap into the top 20. I only saw this happen once in the past actually, with Ruby. Around the time Rails reached 1.0 status Ruby suddenly leaped from near the bottom into the top 20. Since then it has continued a strong upward trend. It’s likely to pass C# very soon, which is a major accomplishment (take that Mono!).

I had been doing Ruby for about a year when that happened and since then there’s been far from any shortage in work. I’ve always tried to push the edge in programming languages and usually achieved quite a bit of criticism in the process. I’ve heard the “well it’s way too unstable and dangerous to use in production” argument time after time. Stability is all in your testing friends… but that’s another topic.

The language of the month for November is unquestionably Lua. It has moved up 32 spots over the past year and still continues a strong upward trend. It has gone from 48th position to 16. Surprisingly this was done without all of the incessant hype that was associated with Ruby on Rails.

I noticed Lua a few years ago, when I started hearing about it being used in game development by Blizzard and others. The use of a scripting language in gaming piqued my curiosity. I never had the chance to learn much of it though (Ruby/Rails has dominated my development career over the past few years). Maybe now is the time.

So what makes Lua so great? It’s small (tiny really), extremely flexible, and exceptionally fast. It has an elegant implementation that is paradigm agnostic. Lua was designed to be used as an extension to C (Lua is attached to C code) but can run through an independent interpreter.

In contrast, Ruby is a very large, extremely flexible, and exceptionally slow programming language. It’s implementation is purely object oriented (although functional programming is possible) . Ruby was designed to allow C extensions (C is attached to Ruby code).

Speed isn’t everything. Choosing sides for a paradigm isn’t necessarily bad either. What’s interesting to me is how well the two complement each other. All languages have strengths and weaknesses. Lua may be a good answer for those times where Ruby is the sledgehammer when all you need is a scalpel. Especially for those rare performance critical applications.

One thing is certain, both are here to stay.