Overview

Sweet Lua is a C++ to Lua binding library. It requires Microsoft Visual Studio 2008 (MSVC 9.0).

Features:

Anti-features:

Luabind vs Sweet Lua

Luabind is a C++/Lua binding library written by Daniel Wallin and Arvid Nordberg. Documentation is available at http://www.rasterbar.com/products/luabind/docs.html.

Luabind provides more infrastructure for object oriented programming than Sweet Lua does. Luabind provides explicit support for registering classes with the Lua environment while Sweet Lua provides support for calling member functions on objects but leaves the implementation of object orientation to the client. We believe this is a more flexible approach and allows the scripting environment to more closely match the problem domain.

Luabind supports overloaded functions stored in the same value in Lua and uses best match signature matching based on the types of parameter passed when the function is called. Sweet Lua supports overloaded functions but doesn't do signature matching so overloaded functions must be stored in different values in the Lua virtual machine. If parameters of the wrong type are passed then Sweet Lua generates an error.

Luabind uses return value and parameter policies to affect the way in which return values and parameters are passed between C++ and Lua. Sweet Lua provides return value policies to raw, yielding, and weakening functions.

Luabind depends on Boost but Sweet Lua does not.

Luabind is tested on far more compilers while Sweet Lua is only tested and supported with Visual Studio 9.0.

In summary Luabind offers more out of the box support for C++ style object orientation with Lua - it provides a C++ like environment in Lua. Sweet Lua doesn't provide as much out of the box support for object orientation - it provides a Lua like environment for C++ to host - with support for the style of object orientation and execution model more in control of the C++ application developer.

SWIG vs Sweet Lua

SWIG (simple wrapper interface generator) generates code to interface C++ programs with scripting languages. Documentation is available at http://www.swig.org/index.php.

SWIG generates C++ source code to provide bindings from C++ header files and so requires an extra conversion step in addition to compilation. Sweet Lua is written in straight C++ and so compiles as part of your source code.

SWIG generates bindings for many scripting languages as well as for Lua. Sweet Lua only helps with binding to Lua.

In summary SWIG is probably better for you if you want to support binding to other languages in addition to Lua and if you don't mind adding an additional generation step to your build.