A while ago I wrote about the troubles I was having with Lua bindings. Some were too heavy, some were too flaky.
And after spending all that time reviewing them, I ran out of time and had to pick one – and I made the mistake of picking a flaky one, with the result being that I have wasted a LOT of time over the past year fixing corner cases and issues with it.
Over the past few weeks, though, I’ve been encouraging and working with Gaspard Bucher on his Dub binding generator. I liked the design at the start – it uses templates to specify what the binding code should look like, and it parses C++ headers using the well-tested documentation tool Doxygen.
What I didn’t like was that it was written in Ruby. Note the past tense. Partly at my prodding he decided to start a port from Ruby to Lua.
Don’t get me wrong; Ruby is a nice language for writing tools. The problem is that Ruby is heavy and comes in many versions – using Ruby in a tool requires that you end up with an entire Ruby ecosystem on your computer, and using it in more than one tool pretty much requires that you also have a Ruby ecosystem manager. No, Dub 2.0 is written in Lua, and I have a set of bindings for my library that are lighter than the lightest emitted by any of the tools I reviewed, and (probably?) faster than the fastest code output from those tools as well. (No benchmarks yet, but the code is tight!)
Working with Gaspard has been great, too – he’s been very helpful in showing me how to use the tool, and in fixing issues as I’ve come across them. I’m hoping to help put together some documentation for Dub, since that’s the only thing that it’s really lacking at the moment, and I tend to like to write documentation.
So my new conclusion is that Dub is the coolest Lua Binding Generator for games and other applications where you need speed and lightweight code!