Lua: About

About

Lua is a lightweight, high-level, multi-paradigm programming language designed primarily for embedded use in applications. Lua is cross-platform, since the interpreter of compiled bytecode is written in ANSI C, and Lua has a relatively simple C API to embed it into applications.

Lua was originally designed and first released in 1993 as a language for extending software applications to meet the increasing demand for customization at the time.

Lua means "Moon" in from Portuguese. It was created by Roberto Ierusalimschy, Luiz Henrique de Figueiredo, and Waldemar Celes, members of the Computer Graphics Technology Group (Tecgraf) at the Pontifical Catholic University of Rio de Janeiro, in Brazil.

As a result of strong computer hardware and software trade barrier policies in Brail in the late 1970s through early 1990s, Tecgraf's clients could not afford to buy customized software from abroad which led to their implementation of basic tools from scratch. Lua was influenced by the languages C++, CLU, Modula, Scheme, and SNOBOL. It later became of influence to other languages that would be developed, namely, GameMonkey, Io, JavaScript, Julia, MiniD, Red, Ring, Ruby, Squirrel, MoonScript, and C--.

Like Java, Lua programs are not interpreted directly, but are compiled into bytecode, which is then run on the Lua virtual machine. This is what enables the cross-platform nature. The compilation process is typically invisible to the user and is performed during run-time, but it can be done offline in order to increase loading performance or reduce the memory footprint of the host environment by leaving out the compiler.

Although Lua does not have a built-in classes, object-oriented programming can be achieved using two language features: first-class functions and tables. Extensible semantics is a key feature of Lua, and the metatable concept allows Lua's tables to be customized in powerful ways. Tables are one of the most important data structures (and, by design, the only built-in composite data type) in Lua and are the foundation of all user-created types. They are conceptually similar to associative arrays in PHP, dictionaries in Python and hashes in Ruby or Perl.

Lua has four types of loops: the while loop, the repeat loop (similar to a do while loop), the numeric for loop, and the generic for loop.


Lua Uses

Lua is widely used scripting language in video game development by game programmers, likely due to its perceived easiness to embed, fast execution, and short learning curve. In 2003, a poll conducted by GameDev.net showed Lua was the most popular scripting language for game programming. In 2012, Lua was announced as a winner of the Front Line Award 2011 from the magazine Game Developer in the category Programming Tools.

Lua is also used in the following applications (among many others):

  • Adobe Photoshop Lightroom uses Lua for its user interface.
  • Apache HTTP Server can use Lua anywhere in the request process.
  • Cisco Systems uses Lua to implement Dynamic Access Policies within the Adaptive Security Appliance (ASA).
  • Flame, a large and highly sophisticated piece of malware being used for cyber espionage.
  • MySQL Workbench uses Lua for its extensions and add-ons.
  • PowerDNS offers extensive Lua scripting for serving and changing DNS answers, fixing up broken servers, and DoS protection.
  • SAS integrates Lua with the PROC.