lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

I try to make a stab at this one.

Disclaimer 1: I am currently working on the Lua bindings for SWIG, so I may well be biased.
Disclaimer 2: I have only used the SWIG bindings most, so my SWIG writing will be accurate. For the others It will be based upon looking at the manuals 

Input formats:
toLua++ needs a cleaned up C/C++ header file, which has a few specific items in it
luabind uses template metaprogramming which has its own rather unusual syntax.
SWIG reads C/C++ headers directly. You could feed is a cleaned up header file, but its rarely needed. You may need to tell it to ignore certain functions/classes, but generally it can just read code directly. (The purpose of SWIG is to easily produce wrappers of existing C/C++ code, requiring no modification of the original code, and minimal work to customise the wrappers)

Method of working:
both tolua++ & SWIG parse the input files & spit out a binding file which you compile & link. tolua++ has an additional library, SWIG puts all of its code into one binding file (which makes SWIG binding a chunk larger then tolua++)
luabind is compiled directly, it means you need a fairly modern compiler VC6(SP5) GCC3.x, whereas the tolua++ & SWIG should work on older compilers.

What is supports:
(I am not so clear on this, if I am wrong please correct me)
All support most of the common stuff (functions, classes, operator overloading, global variables)
tolua++ might not support smart pointers
luabind documentation on use of template functions is not clear (its all templates)
SWIG support for const/non const member functions is iffy

tolua++ support for arrays is good
SWIG can perform it, but you need to supply hints to SWIG
I cannot find anything in the luabind about this

As for in/out parameters (eg void swap(int& a, int& b); )
tolua++ seems to assume all pointer/ref parameters are both in& out
SWIG requires you to specify hints
again I cannot find anything in the luabind docs on this

luabind seems to have good STL support built in
SWIG has partial support (string & vector mainly)
tolua++ doesnt seem to have it, but if you wrote the definition for std::vector in your package file, it should work.

I hope this will give people some idea of the types.

Mark Gossage