Selecting a Lua/C++ binding library

Started by
12 comments, last by guanohead 12 years, 1 month ago
Really, you could sit here and weigh the pros and cons of each of the utilities, asking other people why they chose what they did, for the next six weeks and you probably won't get anywhere. If it's really that big of an issue (hint: it's not as big as you might think) then pick up two or three and try them out. Work through the samples in the docs, see how they feel for you. If in further doubt, do a small project using one and if it doesn't feel right, try another. I'm concerned you may be spending too much time worrying about something that really isn't that significant.

Why someone chooses one over the other probably has little to do with which one you should choose. For example, initially I chose tolua completely at random. It was the first in the list that I glanced at, so I downloaded it and gave it a whack. It worked, so I ran with it.
Advertisement
I use luaBind...I like use of the overloaded operators to make it look like its some other language embedded into C++ but it's actual c++ syntax (read the docs for the details). The binding is pretty easy and calling lua functions through luabind's object is just the same. My beef is that it requires the boost library, adds to compilation time, and it has some memory overhead. There's some bizarre behavior that comes with luaBind, so beware!
My advice is that you download luabind, tolua and luna and give it a try. Thats what I did (after reading the docs) and finnally i decided to use tolua++. I dont remember if i had some problems compiling luabind.
If you decide to use tolua++, I can give you a simple demo i made that ilustrates the use of pkg files to bind a class and some constants, and read/writing C++ classes from lua scripts.
While this is quite an old thread, it's also one of the first that pulled up with a google search. I wanted to point out this comparison of lua/c++ bindings for those who come to this thread in the future.

This topic is closed to new replies.

Advertisement