Difference between revisions of "Lua"

From Mario Fan Games Galaxy Wiki
m
m
Line 1: Line 1:
 
{{Lua}}
 
{{Lua}}
'''Lua''' is a kind of scripting language known as an ''extension language''. Though standalone programs can be coded entirely in Lua, it is intended to be used as a way for users of a program to easily add functionality through scripts. Three Lua extensions exist for [[MMF2]], and a few users of said program use it as a way of working around MMF's lack of a scripting language. A Lua script can also run much faster than an equivalent script made through MMF's event editor, especially if using XLua's or Lua+'s MMF interface functions. [[Retriever II]] has used the language extensively by submitting [[howtos]], creating an [[NCFC]] booth about Lua, coding the [[Tile Lattice]] level editor, and even programming the third Lua extension XLua.
+
'''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 [[Lua: Metamethods|features]]. In addition, Lua supports external C libraries to provide extra functionality, and a special <tt>[[Lua: Userdata|userdata]]</tt> type that can be manipulated both in C and Lua.
  
MFGG projects that use or may use 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 [[Lua: Tables|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 [[function]]s, [[Lua: Coroutines|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:
 
*[[Pocket Mario]] (?)
 
*[[Pocket Mario]] (?)
 
*[[Super Daisy: Legend of the Ztar Rod]] (?)
 
*[[Super Daisy: Legend of the Ztar Rod]] (?)
*[[MPUZ Revolution]]
+
*[[MPUZ]]
 
*[[COSINE]]
 
*[[COSINE]]
 
*[[Tile Lattice]]
 
*[[Tile Lattice]]
*[[MechaSource|MechaSource Games]]
+
*[[MechaSource]] and its games
 
 
== Advantages ==
 
* Generally much faster than MMF alone
 
* Less hassle involved in changing code
 
* Opens up the possibility for moddable games
 
* XLua includes Windows messaging and keyboard intercept capability, and other extensions can be compiled to be compatible with it through libraries
 
 
 
== Disadvantages ==
 
* XLua and Lua+ have only limited integration through the MMF interface (but more features can be added on request)
 
* Moddable games usually require an entire runtime engine to be written
 
* Occasionally has ambiguous error messages, making debugging difficult
 
* Lua and Lua+ extensions are quite unstable
 
  
 
== External Links ==
 
== External Links ==
 
*[http://en.wikipedia.org/wiki/Lua_(programming_language) Wikipedia Article]
 
*[http://en.wikipedia.org/wiki/Lua_(programming_language) Wikipedia Article]
 
*[http://www.lua.org/manual/5.1/manual.html#2 Official Manual]
 
*[http://www.lua.org/manual/5.1/manual.html#2 Official Manual]
*[http://www.lua.org/demo.html Online version of Lua5.1.exe]  
+
*[http://www.lua.org/demo.html Online version of Lua5.1.exe]
 +
*[http://www.lua-users.org Lots of information, tutorials, and sample code]  
  
  
 
[[Category:Tool]]
 
[[Category:Tool]]

Revision as of 05:58, 26 September 2009

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