Lua

From Mario Fan Games Galaxy Wiki
Revision as of 05:58, 26 September 2009 by Xgoff (talk | contribs)
Lua
Lua.gif
Basics
Intermediate
Advanced
XLua
Add to this template
 Standardwikimessagebox.png This article assumes the use of Lua 5.1.

Information may not be accurate or may need revision if you are using a different version.

Lua is a scripting language that is designed for embedding. As a result, it was designed based on an entirely different set of principles than most languages; it is quite minimalist, not providing as many features of higher-level languages. However, most of these features can be implemented or emulated relatively easily due to powerful features. In addition, Lua supports external C libraries to provide extra functionality, and a special userdata type that can be manipulated both in C and Lua.

Lua is extremely fast, almost always one of if not the fastest scripting languages for a given task, and can be easily ported to almost any platform or hardware with the few hundred KB of storage space required for the implementation. For these reasons it sees wide use in game programming. MMF2 has three Lua extensions, though XLua is the only one actively developed and the most stable.

Lua is built off of a single complex data structure, the table, which efficiently incorporates both hash table and array sections. Most custom data objects will in fact be tables, often with their own set of methods and functions.

Lua borrows much of its feature set from Scheme; in fact, few other parts of the design stemmed from other languages. It has full support for anonymous functions, coroutines and first-class functions, which often go missing in other languages. Its roots as a data-description language also allow for convenient syntactic sugar in some cases.

The current version is 5.1, or more specifically 5.1.4, with version 5.2 in progress.

MFGG projects that may use Lua:

External Links