Lua
From Halbeeg, the open encyclopedia · Af-Soomaali
75 languages
Lua is a programming language designed to be lightweight, fast-executing, and easily embedded within larger programs. The name 'Lua' derives from Portuguese and means 'moon'. It originated in Brazil and was created at a university in Rio de Janeiro (PUC-Rio) in the early 1990s.
Lua is noted for its embedding capability—the ability to integrate the language into other programs, such as computer games or network operating systems, allowing users or developers to write modifiable code without rebuilding the entire program. The Lua interpreter is written in C and is small and easily portable to different platforms.
Language features
Lua is a dynamically typed language: data types are not specified at write time but are determined at runtime. Its most important data structure is the table—a hybrid of arrays and key-value dictionaries. Tables can be constructed as arrays, lists, and even object-oriented systems using the metatable mechanism. Lua also supports closures and first-class functions.
Execution and LuaJIT
Lua code is first converted to bytecode, then executed by a virtual machine. There is also an alternative implementation called LuaJIT, which uses just-in-time compilation to improve performance. Memory is managed by a garbage collection system that automatically frees data no longer in use.
Applications
The video game industry is one of the largest contexts for Lua use, as many game engines employ Lua for scripting. It is also used in network tools, embedded systems, and web applications—for example, some wiki systems use Lua for template creation and self-populating text sections.