Lua
 | | Paradigm: | Multi-paradigm | | Appeared in: | 1993 | | Designed by: | Roberto Ierusalimschy Waldemar Celes Lua Programming Language Logo File links The following pages link to this file: Lua programming language ...
A programming paradigm is a paradigmatic style of programming (compare with a methodology, which is a paradigmatic style of doing software engineering). ...
Roberto Ierusalimschy is an associate professor of informatics at PUC-Rio (Pontifical University in Rio de Janeiro). ...
Luiz Henrique de Figueiredo | | Latest release: | 5.1.1 / June 9th, 2006 | | Influenced by: | Python, Icon | | OS: | Cross-platform | | License: | MIT License | | Website: | www.lua.org | | The Lua (pronounced LOO-ah, or /'lua/ in IPA) programming language is a lightweight, reflective, imperative and procedural language, designed as a scripting language with extensible semantics as a primary goal. The name is derived from the Portuguese word for moon. A software release refers to the creation and availability of a new version of a computer software product. ...
Python is an interpreted programming language created by Guido van Rossum in 1990. ...
Icon is a very high-level programming language featuring goal directed execution and excellent facilities for managing strings and textual patterns. ...
An operating system (OS) is a software program that manages the hardware and software resources of a computer. ...
A cross-platform (or platform independent) programming language, software application or hardware device works on more than one system platform (e. ...
A software license is a legal agreement which may take the form of a proprietary or gratuitous license as well as a memorandum of contract between a producer and a user of computer software. ...
The MIT License, originated at the Massachusetts Institute of Technology, is a license for the use of certain types of computer software. ...
This page as shown in the AOL 9. ...
The International Phonetic Alphabet (IPA) is a system of phonetic notation devised by linguists to accurately and uniquely represent each of the wide variety of sounds (phones or phonemes) used in spoken human language. ...
Programming language is the current computer science collaboration of the week! Please help improve it to featured article standard. ...
In computer science, reflection (or computational reflection) is the ability of a program to observe and possibly modify its structure and behavior. ...
In computer science, imperative programming, as opposed to declarative programming, is a programming paradigm that describes computation in terms of a program state and statements that change the program state. ...
This article or section does not cite its references or sources. ...
Scripting languages (commonly called scripting programming languages or script languages) are computer programming languages initially used only for simple, repeated actions. ...
Extension languages allow users, programmers, and third-party developers to add features to a program without having to re-write the program as a whole, and it allows people extending a program to co-operate with each other, without having to expend any extra effort. ...
In the main, semantics (from the Greek and in greek letters ÏημανÏικÏÏ or in latin letters semantikós, or significant meaning, derived from sema, sign) is the study of meaning, in some sense of that term. ...
Philosophy Lua is commonly described as a "multi-paradigm" language, providing a small set of general features that can be extended to fit different problem types, rather than providing a more complex and rigid specification to match a single paradigm. Lua, for instance, does not contain explicit support for inheritance, but allows it to be implemented relatively easily with fallbacks. Similarly, Lua allows programmers to implement namespaces, classes, and other related features using its single table implementation; first class functions allow the employment of many powerful techniques from functional programming; and full lexical scoping allows fine-grained information hiding to enforce the principle of least privilege. A programming paradigm is a paradigmatic style of programming (compare with a methodology, which is a paradigmatic style of doing software engineering). ...
This article is about inheritance in object-oriented programming. ...
In many programming languages, a namespace is a context for identifiers. ...
In object-oriented programming, a class consists of encapsulated instance variables and subprograms, the methods mentioned below. ...
In computer science, a first class function is a programming language construct that allows a function to be treated in many respects like ordinary data objects. ...
Functional programming is a programming paradigm that conceives computation as the evaluation of mathematical functions and avoids state and mutable data. ...
In computer science, the principle of information hiding is the hiding of design decisions in a computer program that are most likely to change, thus protecting other parts of the program from change if the design decision is changed. ...
In computer science and other fields the principle of minimal privilege, also known as principle of least privilege or just least privilege, requires that in a particular abstraction layer of a computing environment every module (which can be for example, a process, a user or a program on the basis...
In general, Lua strives to provide flexible meta-features that can be extended as needed, rather than supply a feature-set specific to one programming paradigm. As a result, the base language is light—in fact, the full reference interpreter is only about 150KB compiled—and easily adaptable to a broad range of applications. An interpreter is a computer program that executes other programs. ...
History Lua was created in 1993 by Roberto Ierusalimschy, Luiz Henrique de Figueiredo, and Waldemar Celes, members of the Computer Graphics Technology Group at PUC-Rio, the Pontifical University of Rio de Janeiro, in Brazil. Versions of Lua prior to version 5.0 were released under a license similar to the BSD license. From version 5.0 onwards, Lua has been licensed under the MIT License. Roberto Ierusalimschy is an associate professor of informatics at PUC-Rio (Pontifical University in Rio de Janeiro). ...
// Overview Cardeal Leme building The PontifÃcia Universidade Católica do Rio de Janeiro (PUC-Rio) is a private non-profit Pontifical University. ...
A Pontifical university is a Roman Catholic university established by and directly under the authority of the Holy See. ...
Flag Seal Location Location of Rio de Janeiro Government Country Region State Brazil Southeast Rio de Janeiro Mayor Cesar Maia (PFL) Geographical characteristics Area City 1,260 km² km² Population City (2005) 6,023,699 Density 4. ...
Berkeley Software Distribution (BSD, sometimes called Berkeley Unix) is the Unix derivative distributed by the University of California, Berkeley starting in the 1970s. ...
The MIT License, originated at the Massachusetts Institute of Technology, is a license for the use of certain types of computer software. ...
Lua has been used in many commercial applications (e.g., in Vendetta Online, LucasArts' Escape from Monkey Island adventure game, World of Warcraft, robot control software, Homeworld 2, and Adobe Lightroom) as well as non-commercial applications (like Angband and its variants). A ported version of Lua has been used to program homebrew for the Playstation Portable and then Nintendo DS. Some of its closest relatives include Icon for its design and Python for its ease of use by non-programmers. Vendetta Onlines Itani Valkyrie Vendetta Online is a twitch-based, science fiction massively multiplayer online role-playing game (MMORPG) developed by Guild Software for the Microsoft Windows, Mac OS X, and Linux operating systems. ...
LucasArts Entertainment Company is a video game developer and publisher. ...
Escape from Monkey Island (EMI) is the fourth, and currently final, game in the Monkey Island series of computer adventure games, released in 2000 by LucasArts, following the successful games The Secret of Monkey Island (SMI), Monkey Island 2: LeChucks Revenge (MI2), and The Curse of Monkey Island (CMI). ...
Adventure is a genre of video game typified by exploration, puzzle-solving, interaction with game characters, and a focus on narrative rather than reflex-based challenges. ...
World of Warcraft (commonly abbreviated as WoW) is a massively multiplayer online role-playing game (MMORPG) developed by Blizzard Entertainment. ...
This article may be excessively or inappropriately using first or second person, contrary to the formal tone expected of an encyclopedia entry. ...
Lightroom is a software program for Mac OS X and, in the future, Microsoft Windows, which became available in a Mac-only beta version on January 9, 2006, designed to assist professional photographers in post-production work. ...
Angband is a dungeon-crawling roguelike computer game derived from Umoria (the C for Unix port of a game called Moria). ...
Homebrew video games are video games written by hobby programmers. ...
The PlayStation Portable (officially PSP) is a handheld game console produced by Sony Computer Entertainment. ...
The Nintendo DS (sometimes abbreviated NDS or DS) is a handheld game console developed and manufactured by Nintendo, released in 2004. ...
Icon is a very high-level programming language featuring goal directed execution and excellent facilities for managing strings and textual patterns. ...
Python is an interpreted programming language created by Guido van Rossum in 1990. ...
Features Lua is a dynamically typed language intended for use as an extension or scripting language, and is compact enough to fit on a variety of host platforms. It supports only a small number of atomic data structures such as boolean values, numbers (double-precision floating point by default), and strings. Typical data structures such as arrays, sets, hash tables, lists, and records can be represented using Lua's single native data structure, the table, which is essentially a heterogeneous map. Extension languages allow users, programmers, and third-party developers to add features to a program without having to re-write the program as a whole, and it allows people extending a program to co-operate with each other, without having to expend any extra effort. ...
Scripting languages (commonly called scripting programming languages or script languages) are computer programming languages initially used only for simple, repeated actions. ...
The adjective Boolean (sometimes boolean), coined in honor of George Boole, is used in many contexts: An evaluation that results in either TRUE or FALSE. A boolean value is a truth value, either true or false, often coded 1 and 0, respectively. ...
Numbers can mean: Number The Book of Numbers, the fourth book of the Bible NUMB3RS, a CBS television show This is a disambiguation page — a navigational aid which lists other pages that might otherwise share the same title. ...
A floating-point number is a digital representation for a number in a certain subset of the rational numbers, and is often used to approximate an arbitrary real number on a computer. ...
In computer programming and some branches of mathematics, strings are sequences of various simple objects. ...
In computer programming, an array, also known as a vector or list (for one-dimensional arrays) or a matrix (for two-dimensional arrays), is one of the simplest data structures. ...
In computer science, the set is a collection of certain values without any particular order. ...
In computer science, a hash table is a data structure that speeds up searching for information by a particular aspect of that information, called a key. ...
Look up list in Wiktionary, the free dictionary This article is about the word list as used in computer science. ...
This article is about the data structure. ...
In computing, an associative array, also known as a map, lookup table, or dictionary, is an abstract data type very closely related to the mathematical concept of a function with a finite domain. ...
Lua has no built-in support for namespaces and object-oriented programing. Instead, metatable and metamethods are used to extend the language to support both programing paradigms in an elegant and straight-forward manner. Object-oriented programming (OOP) is a computer programming paradigm in which a software system is modeled as a set of objects that interact with each other. ...
Lua implements a small set of advanced features such as higher-order functions, garbage collection, first-class functions, closures, proper tail calls, coercion (automatic conversion between string and number values at run time), coroutines (collaborative multithreading) and dynamic module loading. In mathematics and computer science, higher-order functions are functions which can take other functions as arguments, and may also return functions as results. ...
In computer science, garbage collection (also known as GC) is a form of automatic memory management. ...
In computer science, a programming language is said to support first-class functions if it treats functions as first-class objects. ...
In programming languages, a closure is a function that refers to free variables in its lexical context. ...
In computer science, tail recursion is a special case of recursion that can be easily transformed into an iteration. ...
In computer science, type conversion or typecasting refers to changing an entity of one datatype into another. ...
In computer science, coroutines are program components that generalize subroutines to allow multiple entry points and suspending and resuming of execution at certain locations. ...
By including only a minimum set of data types, Lua attempts to strike a balance between power and size.
Example code The classic hello world program can be written as follows: To meet Wikipedias quality standards, this article or section may require cleanup. ...
print "Hello, world!" The factorial is an example of a recursive function: In mathematics, the factorial of a natural number n is the product of all positive integers less than or equal to n. ...
A Sierpinski triangle âa confined recursion of triangles to form a geometric lattice. ...
function factorial(n) if n == 0 then return 1 end return n * factorial(n - 1) end Lua's treatment of functions as first class variables is shown in the following example, where the print function's behavior is modified: do local oldprint = print -- store current print function as old print print = function(s) -- redefine print function if s == "foo" then oldprint("bar") else oldprint(s) end end end Any future calls to "print" will now be routed through the new function, and thanks to Lua's lexical scoping, the old print function will only be accessible by the new, modified print. In computer programming in general, a scope is an enclosing context. ...
Extensible semantics is a key feature of Lua, and the "metatable" concept allows Lua's tables to be customized in powerful and unique ways. The following example demonstrates an "infinite" table. For any n, fibs[n] will give the nth Fibonacci number using dynamic programming. In mathematics, the Fibonacci numbers, named after Leonardo of Pisa, known as Fibonacci, form a sequence defined recursively by: In other words, each number is the sum of the two numbers before it. ...
In computer science, dynamic programming is a method for reducing the runtime of algorithms exhibiting the properties of overlapping subproblems and optimal substructure, described below. ...
fibs = { 1, 1 } -- Initial values for fibs[1] and fibs[2]. setmetatable(fibs, { -- Give fibs some magic behavior. __index = function(fibs,n) -- Call this function if fibs[n] does not exist. fibs[n] = fibs[n-2] + fibs[n-1] -- Calculate and memoize fibs[n]. return fibs[n] end }) Tables Tables are the most important data structure in Lua, and are the foundation of all user-created types. The table is a collection of key and data pairs (known also as hashed heterogeneous associative array), where the data is referenced by key. The key (index) can be of any data type except nil. In computer science, a hash table is a data structure that speeds up searching for information by a particular aspect of that information, called a key. ...
Look up Heterogeneous in Wiktionary, the free dictionary. ...
An associative array (also dictionary, finite map, map, lookup table, and in query-processing an index or index file) is an abstract data type composed of a collection of keys and a collection of values, where each key is associated with one value. ...
Table as structure Tables are often used as structures (or objects) by using strings as keys. Because such use is very common, Lua features a special syntax for accessing such fields. Example: In computer science, composition is a way and practice to combine simple objects or data types into more complex ones. ...
In computer programming and some branches of mathematics, strings are sequences of various simple objects. ...
point = { x = 10, y = 20 } -- Create new table print( point["x"] ) -- Prints 10 print( point.x ) -- Has exactly the same meaning as line above Table as array By using a numerical key, the table resembles an array data type. In computer programming, an array, also known as a vector or list (for one-dimensional arrays) or a matrix (for two-dimensional arrays), is one of the simplest data structures. ...
A simple array of the strings: array = { "a", "b", "c", "d" } -- Indexes are assigned automatically print( array[2] ) -- Prints "b" An array of objects: function Point(x,y) -- "Point" object constructor return {x = x, y = y} -- Creates and returns a new object (table) end array = { Point(10,20), Point(30,40), Point(50,60) } -- Creates array of points print( array[2].y ) -- Prints 40 In object-oriented programming, a constructor in a class is a special method (function) that can be used to create objects of the class and never has a return type. ...
Object-oriented programming Although Lua does not have a built-in concept of classes and objects, the language is powerful enough to easily implement them using two language features: first-class functions and tables. By simply placing functions and related data into a table, an object is formed. Inheritance (both single and multiple) can be implemented via the "metatable" mechanism, telling the object to lookup nonexistent methods and field in parent object(s). In object-oriented programming, classes are used to group related variables and functions. ...
In strictly mathematical branches of computer science the term object is used in a purely mathematical sense to refer to any thing. While this interpretation is useful in the discussion of abstract theory, it is not concrete enough to serve as a primitive datatype in the discussion of more concrete...
In computer science, a programming language is said to support first-class functions if it treats functions as first-class objects. ...
This article is about inheritance in object-oriented programming. ...
Note that there is no such concept as "class" with these techniques, rather "prototypes" are used as in Self programming language. New objects are created either with a factory method (that constructs new objects from scratch) or by cloning an existing object. Prototype-based programming is a style and subset of object-oriented programming in which classes are not present, and behaviour reuse (known as inheritance in class-based languages) is accomplished through a process of cloning existing objects which serve as prototypes. ...
This article or section does not cite its references or sources. ...
The Factory Method pattern is an object-oriented design pattern. ...
Internals Lua programs are not interpreted directly, but are compiled to bytecode which is then run on the Lua virtual machine. The compilation process is typically transparent to the user and is performed during run-time, but it can be done offline in order to increase performance or reduce the memory footprint of the host environment by leaving out the compiler. In computer programming, an interpreted language is a programming language whose programs may be executed from source form, by an interpreter. ...
A diagram of the operation of a typical multi-language compiler. ...
Byte-code is a sort of intermediate code that is more abstract than machine code. ...
In general terms, a virtual machine in computer science is software that creates a virtualized environment between the computer platform and the end user in which the end user can operate software. ...
In computer science, runtime describes the operation of a computer program, the duration of its execution, from beginning to termination (compare compile time). ...
There is also a third-party just-in-time Lua run-time, called LuaJIT, for the new 5.1 version. See also Just in time for the business technique In computing, just-in-time compilation (JIT), also known as dynamic translation, is a technique for improving the performance of interpreted programs. ...
This example is the bytecode listing of the factorial function described above (in Lua 5.0): function <factorial.lua:1> (10 instructions, 40 bytes at 00326DA0) 1 param, 3 stacks, 0 upvalues, 1 local, 3 constants, 0 functions 1 [2] EQ 0 0 250 ; compare value to 0 2 [2] JMP 0 2 ; to line 5 3 [3] LOADK 1 1 ; 1 4 [3] RETURN 1 2 0 5 [6] GETGLOBAL 1 2 ; fact 6 [6] SUB 2 0 251 ; - 1 7 [6] CALL 1 2 2 8 [6] MUL 1 0 1 9 [6] RETURN 1 2 0 10 [7] RETURN 0 1 0 Applications Lua, as a compiled binary, is incredibly small by code standards. Coupled with its relatively fast speed, and its very lenient license, it has gained a following among game developers for providing a viable scripting interface. Examples of Lua in gaming applications: A computer game is a game composed of a computer-controlled virtual universe that players interact with in order to achieve a defined goal or set of goals. ...
- World of Warcraft, a fantasy MMORPG, Lua is used to allow users to customize its user interface, character animation and world appearance.
- Far Cry, a first-person shooter. Lua is used to script a substantial chunk of the game logic, manage game objects (Entity system), configure the HUD and store other configuration information.
- MDK2, Lua is used as a module scripting language.
Lua has uses beyond gaming, of course. Examples of Lua in non-gaming applications: World of Warcraft (commonly abbreviated as WoW) is a massively multiplayer online role-playing game (MMORPG) developed by Blizzard Entertainment. ...
Players interacting in Ultima Online. ...
Far Cry is a first-person shooter computer game developed by Crytek Studios and published by Ubisoft on March 23, 2004. ...
Doom, one of the games that defined the first-person shooter genre. ...
An entity is something that has a distinct, separate existence, though it need not be a material existence. ...
BioWare Corp. ...
Title screen of Baldurs Gate, the first game in the series. ...
It is possible to make realistic-looking pictures in Garrys Mod. ...
Half-Life 2 is a science fiction first-person shooter computer game and the sequel to Half-Life, developed by Valve Corporation. ...
2004 Banshee car modification for Grand Theft Auto: Vice City - replacement of original Banshee by Suction Testicle Man Mod or modification is a term generally applied to computer games, especially first-person shooters and real-time strategy games. ...
Screenshot of Grand Theft Auto: Vice City. ...
Vendetta Onlines Itani Valkyrie Vendetta Online is a twitch-based, science fiction massively multiplayer online role-playing game (MMORPG) developed by Guild Software for the Microsoft Windows, Mac OS X, and Linux operating systems. ...
Players interacting in Ultima Online. ...
MDK2 is the sequel to the third-person shooter, MDK, developed by Shiny Entertainment and released in 1997 by Interplay. ...
- Therescript, used to drive the vehicles and animations in There, is Lua plus some application-specific functions.
- The Aegisub subtitles manipulation program uses Lua in its automation module, to generate advanced effects, such as karaoke.
- In the Klango Environment, Lua is used as a programming language for developing audio games and applications, a software dedicated to the blind and visually impaired. (external link)
- Adobe Lightroom, a beta digital photography post-production program, contains a large amount (40%) of Lua code.
A list of projects known to use Lua is located at Lua.org. There © Copyright 2005 There is a subscription business model internet service created in 1998 by Will Harvey and Jeffrey Ventrella, consisting of an immersive PG-13 3-D virtual world which is complemented by 2-D web-based services. ...
On Microsoft Windows 95, 98, and ME you can enter the Windows device manager by clicking Start, Settings, Control Panel, System icon, and clicking on the Device Manager tab. ...
For other uses of this term, see Ion (disambiguation). ...
Aegisub logo Aegisub is a computer program created to help in many aspects of typesetting and to correct/add many features found in the Medusa Subtitling Station. ...
In printed material In printed material, a subtitle is an explanatory or alternate title. ...
A Karaoke machine Karaoke (Japanese: ã«ã©ãªã±, from 空 kara, empty or void, and ãªã¼ã±ã¹ãã© Åkesutora, orchestra) is a form of entertainment in which an amateur singer or singers sing along with recorded music on microphone. ...
RM-X General Purpose Control is a tool for seamless integration of hardware, software and user all in one tiny package. ...
A plugin (or plug-in) is a computer program that can, or must, interact with another program to provide a certain, usually very specific, function. ...
Scripting programming languages (commonly called scripting languages or script languages) are computer programming languages designed for scripting the operation of a computer. ...
In computer science, a subroutine (function, method, procedure, or subprogram) is a portion of code within a larger program, which performs a specific task and is relatively independent of the remaining code. ...
In computer science, run time (with a space, though often its spelled without one) describes the operation of a computer program, the duration of its execution, from beginning to termination (compare compile time). ...
Intellipool Network Monitor is a network, server and performance monitor designed to monitor Windows, Linux, Unix and SNMP enabled devices. ...
An audio game is a game played on an electronic device. ...
Lua for the PlayStation Portable is interpreted with Lua Player. ...
Sony Computer Entertainment Inc. ...
The PlayStation Portable (officially PSP) is a handheld game console produced by Sony Computer Entertainment. ...
Lightroom is a software program for Mac OS X and, in the future, Microsoft Windows, which became available in a Mac-only beta version on January 9, 2006, designed to assist professional photographers in post-production work. ...
Books External links |