I took another stab at using SWIG for the bindings and I have a working branch that provides about 90% of the OF api now. I have function, class, enum renaming working so this approach doesn’t require all of the tons of boilerplate I wrote for Luabind to rename things, plus overloading is handled for you.
It’s on the swig
branch: https://github.com/danomatika/ofxLua/tree/swig
Pluses of SWIG compared to Luabind:
- easily distributable generated .cpp bindings
- no BOOST C++ lib requirement so building ofxLua is painless
- no templating craziness (aka Xcode slowness, etc)
- no requirement for a separate Xcode project for Luabind
- more maintainable as SWIG handles function overloading and renaming
- Luabind development not completely coordinated (aka not sure who’s work to use since the main dev haven’t worked with it for a few years now)
- SWIG allows for generating Python, Javascript, etc bindings as well as Lua
Minuses of SWIG compared to Luabind:
- can’t inherit C++ classes in Lua
- no Lua “class” instance provided by Luabind (I add a “class” object with Lua code that works the same way)
- need to install SWIG if you want to add your own custom bindings
- making custom bindings needs to be done separately, not at build time
- have to run SWIG to generate custom bindings as a separate step
Overall, I see the pluses of SWIG being worth it. This branch is fully working and tested on OS X and iOS. It should work pretty easily on Win and Linux now that Boost isn’t required.