XLua
From FusionWiki
| XLua | |
|---|---|
| General Information | |
| Author: | Justin Aquadro |
| Release Date: | Feb 2009 |
| Status: | Released |
| Last updated: | Mar 2011 |
| Version: | 1.5.2 |
| Build: | 248 |
| Developer-only: | No |
| Website: | Release Thread |
| Download: | Direct |
| Runtime Versions | |
| HWA: | Yes |
| Flash: | No |
| Java: | Planned |
| Java Mobile: | No |
| Vitalize!: | No |
| Unicode: | No |
XLua is an extension that can run code written in the Lua language. It is the third Lua extension and effectively replaces the Lua and Lua+ objects. XLua implements the important functionality from the other two objects and provides even more.
Other Multimedia Fusion (MMF) extensions can implement an XLua interface which allows them to be used almost entirely through Lua scripts, which can often be much faster than controlling them through event calls. The OpenGL object in particular has this capability, and there is rudimentary support for native MMF objects such as Arrays and Strings.
XLua offers an MMF Interface function set like Lua+, containing many more functions. However, its use has been deprecated in favor of a separate library which implements the same functionality in an object-oriented manner, and eliminates the need to manually export objects.
Contents |
Features
- Current Lua version 5.1.4 plus patches
- JIT-based VM for faster exececution
- Improved error reporting
- Support for both Lua and Lua+ calling conventions
- Support for multiple independent Lua states
- Support for global Lua states
- Support for 3rd party libraries
- Support for multiple embedded scripts
- Syntax-highlighted script editor
- Support for manipulating selection lists
- Well documented
Libraries
XLua can easily be extended by loading 3rd party libraries ("C Modules"). Generally, any existing C Module written for Lua 5.1 can also be used in XLua, but it must be compiled to link against XLua instead of the Lua 5.1 DLL. XLua comes with several C Modules written specifically for it.
XLua Libraries
These libraries have been written specifically for XLua and are maintained and supported by the XLua author.
- MMF Interface: Directly access and manipulate other objects on the frame in an object-oriented framework. Also provides access to some other MMF state.
- XLuaGL: Derived from LuaGL, provides API for most of OpenGL 2.0, used in conjunction with any of the OpenGL objects.
- Array: Provides multi-dimensional, fixed-size, non-garbage-collected storage for numerical data. Can be used in conjunction with some other libraries (e.g. XLuaGL).
3rd Party Libraries
These modules have been written by other authors within the broader Lua community, but have been compiled for use with XLua. If you compile a 3rd party C Module for use with XLua, please share with the rest of the Click community by posting it in the Lua Scripting Forum.
- FMOD audio library: Allows the use of advanced sound effects and the support of many sound formats.
- LuaSocket: Provides a framework for TCP and UDP socket programming.
Many more Lua C Modules can be found at LuaForge and around the Internet.
Usage
XLua an object for managing one or more Lua states and passing control back and forth between a frame's standard event loop and chunks of Lua code. XLua provides more then one way to do most tasks. For example, in the below usage example, the start-of-frame setup could be omitted (by setting appropriate object properties), and defining an explicit function for updating an object's position would be unnecessary if using the MMFI C Module. Another example of choice is that XLua offers both the calling conventions of the first Lua Object and the Lua+ object.
| 1 |
