RSS Feed for This PostCurrent Article

Lua: A Powerful Scripting Language

Lua is a powerful, fast, light-weight, embeddable scripting language.

Lua combines simple procedural syntax with powerful data description constructs based on associative arrays and extensible semantics. Lua is dynamically typed, runs by interpreting bytecode for a register-based virtual machine, and has automatic memory management with incremental garbage collection, making it ideal for configuration, scripting, and rapid prototyping.

Lua is a proven, robust language

Lua has been used in many industrial applications (e.g., Adobe’s Photoshop Lightroom), with an emphasis on embedded systems and games (e.g., World of Warcraft). Lua is currently the leading scripting language in games. Lua has a solid reference manual and there are several books about it. Several versions of Lua have been released and used in real applications since its creation in 1993. Lua featured in HOPL III, the Third ACM SIGPLAN History of Programming Languages Conference, in June 2007.

Lua is fast

Lua has a deserved reputation for performance. To claim to be “as fast as Lua” is an aspiration of other scripting languages. Several benchmarks show Lua as the fastest language in the realm of interpreted scripting languages. Lua is fast not only in fine-tuned benchmark programs, but in real life too. A substantial fraction of large applications have been written in Lua.

Lua is portable

Lua is distributed in a small package and builds out-of-the-box in all platforms that have an ANSI/ISO C compiler. Lua runs on all flavors of Unix and Windows, and also on mobile devices (such as handheld computers and cell phones that use BREW, Symbian, Pocket PC, etc.) and embedded microprocessors (such as ARM and Rabbit) for applications like Lego MindStorms.

Lua is embeddable

Lua is a fast language engine with small footprint that you can embed easily into your application. Lua has a simple and well documented API that allows strong integration with code written in other languages. It is easy to extend Lua with libraries written in other languages. It is also easy to extend programs written in other languages with Lua. Lua has been used to extend programs written not only in C and C++, but also in Java, C#, Smalltalk, Fortran, Ada, and even in other scripting languages, such as Perl and Ruby.

Lua is powerful (but simple)

A fundamental concept in the design of Lua is to provide meta-mechanisms for implementing features, instead of providing a host of features directly in the language. For example, although Lua is not a pure object-oriented language, it does provide meta-mechanisms for implementing classes and inheritance. Lua’s meta-mechanisms bring an economy of concepts and keep the language small, while allowing the semantics to be extended in unconventional ways.

Lua is small

Adding Lua to an application does not bloat it. The tarball for Lua 5.1.4, which contains source code, documentation, and examples, takes 212K compressed and 860K uncompressed. The source contains around 17000 lines of C. Under Linux, the Lua interpreter built with all standard Lua libraries takes 153K and the Lua library takes 203K.

Lua is free

Lua is free software, distributed under a very liberal license (the well-known MIT license). It can be used for any purpose, including commercial purposes, at absolutely no cost. Justdownload it and use it.

For specific reasons why Lua is a good choice also for constrained devices like cell phones, read this summary by Mike Pall.

Trackback URL

RSS Feed for This Post2 Comment(s)

  1. Bojan | Dec 22, 2008 | Reply

    > Lua is powerful (but simple)

    Actually, OOP is not where it’s at.
    First-class functions/closures and co-routines is where the power of Lua is, along with the omnipotent lua-table.

  2. Mark Lee Smith | Dec 22, 2008 | Reply

    Since object-oriented programming in Lua is directly based on tables, claiming that it’s not interesting at the same time as claiming that tables are doesn’t really make sense does it? The ease with which Lua can express objects (i like prototypes) is quite important in my opinion. I personally wouldn’t want to write a large application in a flat procedural/functional style. It makes sense to package behaviour with the data-structure, and you get polymorphism free.

    I’ll use closures when it makes sense but I’m not going to use them to help structure my programs. FYI higher-order functions have been part of OOP (and many other paradigms) since the beginning, and are not as indicative of functional programming as I’m sure you’d like to think they are.

1 Trackback(s)

  1. From Geeks3D Daily News Round-up (2008.12.24) And Merry Xmas! | The Geeks Of 3D | Dec 24, 2008

Sorry, comments for this entry are closed at this time.