beanz Magazine

Lua

oelson on Flickr

Lua is a comparatively simple programming language used in a wide range of places, from digital TVs to video games to phone applications. It's also designed to be simple to use and lightweight.

Lua was first developed in 1993 in Brazil by Roberto Ierusalimschy, Luiz Henrique de Figueiredo, and Waldemar Celes, a team at the Computer Graphics Technology Group (Tecgraf) at the Pontifical Catholic University of Rio de Janeiro in Brazil. Lua translates to “moon” in Portuguese and its name is a play on SOL, which translates to “sun,” one of the languages Lua extended.

Lua was created to extend two languages, SOL (Simple Object Language) and DEL (Data Entry Language), used in engineering applications for Petrobras, the Brazilian energy company. Other language options either did not have the simplicity needed, or were too costly due to Brazilian trade barriers for computer software and hardware. It is free open source software distributed under the MIT license.

From the start, the language has evolved for use by non-professional programmers. The syntax and other features are clear, concise, and fairly easy to read and understand. The Tecgraf team also had to support a variety of computer hardware platforms and operating systems. And, like SOL, the language needed to be embedded easily into other languages.

What makes Lua special?

The language is highly flexible with a small file size. For example, Lua uses a minimal number of data types while also providing a small set of general features to fit different types of problems. Lua works on many computer operating systems because it is written in ANSI C, a low level language standardized by the ANSI and ISO groups and used by language compilers on all computer systems. The language is used on Windows, Unix, and iOS, as well as mobile platforms like Symbian, Android, iOS, and Windows Phone.

The small size of Lua makes it extremely fast. Lua programs are compiled into bytecode which is run on the Lua virtual machine included in the language files. In contrast, other scripting languages are interpreted directly from a script file when the script is called.

Lua can be used directly, through scripts, and indirectly through a simple C API when Lua is included in another language or application as a library file. The C API allows for a common almost universal way to interact with Lua regardless of the language wrapped around Lua, or the platform and operating system used.

Because Lua lacks much of the complexity and structure in many other languages, it is a good place to start coding for beginning and less-technical programmers. Professional programmers find the language simplicity makes it more flexible and faster to code. Lua also is a good model to study how languages are created, evolved, and integrated with other languages.

For people interested in the history of programming languages, how languages come to be and how they evolve, Lua has at least two detailed histories written by its founders to describe many of the problems, solutions, and trade-offs in its development.

How is Lua used?

Lua is used in many different places because of its flexibility and small size. The Angry Birds and World of Warcraft games use the language. So does Adobe’s Photoshop Lightroom. It’s also been used in embedded systems, for example, middleware software in Brazilian digital TVs. Lua also is used to teach coding in the Codea iPad application.

Lua also has been used to extend programs written in C, C++, C#, Java, Smalltalk, Fortran, Ada, and Erlang, as well as Perl and Ruby.

Learn More

Lua

http://www.lua.org/
http://www.lua.org/about.html
http://www.lua.org/pil/

History of Lua

Two presentations describe in detail the evolution of the Lua language.
http://www.lua.org/doc/hopl.pdf (PDF)
http://www.stanford.edu/class/ee380/Abstracts/100310-slides.pdf (PDF)

Wikipedia

http://en.wikipedia.org/wiki/Lua_%28programming_language%29

Lua: Really for Beginners

http://lua.gts-stolberg.de/en/index.php?uml=1

Crashing Into Lua

Includes an inline Lua Interpreter to test and adapt code from this tutorial.
http://luatut.com/crash_course.html

Lua, What is Lua? (Stack Overflow)

Among serious comments and insights, apparently Lua means toilet in Hawaiian.
http://stackoverflow.com/questions/1274972/lua-what-is-lua

Also In The October 2013 Issue

An Interview with Troy Hunt

Troy Hunt is a software architect and Microsoft Most Valued Professional (MVP) focusing on security concepts and process improvement in a Fortune 50 company. He's based in Australia.

1Password, LastPass, RoboForm

If you use a password you created that is less than eight characters, your password is vulnerable to hacking. Here are three ways to create and use secure passwords online.

How to Write Secure Code

Coding securely doesn't have to kill the joy of programming. In fact, learning how to code securely provides insights into languages and computing.

How to Code HTML Email

How to code an HTML email like the ones you open every day turns out to be an offbeat software coding challenge.

What is an SSL Certificate?

How to tell if a web page is secure is one of the most basic yet least obvious ways to protect your data online.

Where to Find Command Line Interface Software

One key computing skill is the ability to use command line interface (CLI) software to enter commands to control a computer. Here are some options.

Lua

Lua is a comparatively simple programming language used in a wide range of places, from digital TVs to video games to phone applications. It's also designed to be simple to use and lightweight.

Arrays

Here is how three programming languages handle a common problem: how do you organize and keep track of useful data?

Linux Command List for Command Line Interfaces

Some of the most common commands you'll need for a command line interface (CLI), in a Linux command list.

Computer science education cannot make anybody an expert programmer any more than studying brushes and pigment can make somebody an expert painter.

News Wire Stories for October 2013

Must read stories about computer science, software programming, and technology for September 2013.

Learn More Links for October 2013

Links from the bottom of all the October 2013 articles, collected in one place for you to print, share, or bookmark.