Libraries Binding Lua to C++

Lua is a fantastically lightweight and super fast scripting language that is the current defacto standard in-game language. Use in many many games, including the infamous World of Warcraft. We used it in my last project with great success as well, but we were never quite satisfied with the level of integration.  And this really stems from the main detractor of Lua. There is no fantastic binding system for gluing it to C++. There are many out there to be sure, but most fall short. The most popular seem to be toLua++ and LuaBind.

toLua++ was the route we decided to go with our last system, but this had caveats.  The system required us to maintain extra “doctored” copies of our headers that could be used for generating the binding code.  This duplicated data caused headaches more than once.  That aside, there were problems with memory bloat, and memory leaks. From what I understand, these issues are known and have yet to be delt with.

LuaBind is probably the most used (rivaled only by toLua++) binding system right now.  It has a few glaring issues of its own though.  Most notably is its heavy use of the boost library.  Boost is a fantastic set of facilities, but it is just too bloated for a project not already reliant on it. This requirement caused builds to take significantly longer due to its heavy use of meta-template programming (something boost users are apparently comfortable with.)  LuaBind also makes my Lua IDE, Decoda, practically unusably sluggish. I’m not sure what is affecting it, but I assume it has something to do with the inflated symbol files it has to parse.

A few runners up that I’m currently considering now are LuaBridge and SLB (Simple Lua Binder). Both of these libraries are essentially building a LuaBind clone without the boost dependency. LuaBridge hasn’t been updated in over 18 months, and is as well as dead, so the plan of action would be to pick up where the original author left off.  While the author of SLB hasn’t posted any updates in months, he has been committing code regularly to the googlecode repository. Right now I’m hoping SLB pans out, but we will see.

Anyone else have a good recommendation?

Leave a Reply

Your email address will not be published. Required fields are marked *

1 × five =