LuaPlus¶
The source code may be downloaded from the new Git repository:
git clone http://git.luaplus.org/luaplus51-all.git
This is old information copied from the other website. It will be updated soon.
The LuaPlus distribution provides the following functionality.
- All the power of the core Lua 5.01 work distribution.
- An optional high performance reference counted garbage collector.
- An easy to use C++ interface:
- The C++ interface, described below, masks many of the intricacies of core Lua's underlying low-level C API. In particular, stack management is mostly ignored. Other useful helper classes, such as management of ref'ed objects or the stack, table traversal, and table lookups are provided, dramatically simplifying the application code.
- Simplified function calling convention. Inspired by, to a limited degree, Python's use of tuples in its C API, the new function calling convention masks the stack pushing and popping associated with the low-level calling convention.
- A newly added function calling convention enables C++ to call Lua functions as if they were regular C++ functions. This goes a long way to simplifying Lua for C++ users.
- A transparent C++ functor implementation is in place, allowing function callbacks to be global or static (as they are now), class member functions, or class member virtual functions.
- Direct registering of C++ functions with LuaPlus. The registered C++ functions do not need to conform to a standard callback declaration.
- .NET wrapper. The .NET version of LuaPlus opens up LuaPlus's features to any .NET based language. This includes C#, Visual Basic, Python, Perl, and others. The Managed C++ version of LuaPlus is nearly identical to its regular C++ counterpart, so transitioning is easy.
- Serialization of Lua tables. Lua is a boon for data management. With a much simpler syntax than XML, while providing equivalent and better data description facilities, a way is needed to write table data in text form. LuaPlus offers this facility, and it does it in such a way that no Lua internal state is changed.
- Win32 DLL and LIB formats. Through the DLL version, a module plug-in system is in place.
- Extra Tools:
- Debugger. The Remote Lua Debugger is one of the most useful facilities provided by LuaPlus. It all but eliminates the need to litter print() statements throughout script code. The Remote Lua Debugger offers a view of the call stack, local variables, watch variables, syntax highlighting, Visual C++ debugger style keystrokes, and much more.
- Visual C++ watch add-in to monitor data types. When manipulating a LuaObject (one of the classes provided by the C++ interface), Visual C++ 6 and Visual Studio .NET show the contents of the LuaObject in the watch window. The LuaWatchAddin makes no distinction between stack objects, ref'ed objects, up-values, or other indices. In addition, if the index being shown is out of range, the LuaWatchAddin represents that.
- The Visual Studio .NET LuaPlus Debugger plug-in allows display of the Lua tables in tree form, local Lua variables, and the current Lua callstack. Stepping through Lua code in the VS .NET environment is not possible at this time, but the Remote Lua Debugger may still be used.
- Lua Core Enhancements:
- Wide character string support.
- Tight integration of the extra string type was necessarily built into the code base. Basically, any reference to LUA_TSTRING in the Lua core code base was supplemented with an equivalent wide character LUA_TWSTRING.
- Direct support for opening Unicode files available.
- Wide character string support.
- Enhanced metatables, wherein basic types, such as strings can have an associated metatable. It only takes a few more lines of code to add this support, and what a world of difference it makes. If the type is an ANSI string or wide character string, it is of no consequence to the user. They can just as easily call the metatable function len() in both cases.
- Ref'ed objects are treated no differently than a stack object. Rather than dealing with low-level lua_getref() calls everywhere to load the ref'ed object onto the stack, the user can just "use" the object. No special management is needed.
- Custom memory allocators and memory optimization support. For those working in embedded environments, better control over memory allocation is a must.