LuaBind

Started by
14 comments, last by ldeej 18 years, 9 months ago
I'm wondering about using LuaBind in my current project, but I've never *gasp* used real scripting before. By real scripting, I mean anything but loading a set of actions that define something, an animation sequence for instance, and I was wondering just how much work it takes to use LuaBind in a project. Here's the meat of the post: Could someone post some sample code of what it takes to use LuaBind in a basic way. Say, create a class in C++, and call a member function in LuaBind. Or, define a class in C++ and extend it in LuaBind. Thanks in advance.
The best way to predict the future is to invent it.
Advertisement
Have you taken a look at the luabind documentation yet? It is really quite awesome and has examples for everything you've asked for, I'd suggest you just take a look around there. It really isn't that hard to use.. :)

http://luabind.sourceforge.net/docs.html
LuaBind seems to be nice, I've never tried. However, toLua looks even nicer (less extra work to do), but I've never tried that either. I suggest you take a look at both and then decide which to use.

-Richardo
Cool. Thanks. I've glanced at the docs for LuaBind, but I was wondering if there was something maybe they weren't telling. I'll take a closer look.

I've never heard of toLua. Is it also on SF? Well, I'll just [google] it.

Thanks, y'all.
The best way to predict the future is to invent it.
toLua does look nice, but I see nothing about deriving lua classes from C++ classes (or even creating lua classes in the first place...)

I can't find out how to build LuaBind. I'm on WinXP, with VC6. How do I do it? And how much of boost do I need? The entire monstrosity?

Help me, please.
The best way to predict the future is to invent it.
Classes in lua are only faked (using an additional hidden parameter), and deriving classes from C++ is not directly possible, you can however map functions to c-functions in Lua and thus using C++-classes in Lua.

And as far as I know, regular Lua was very easy to get up and running.


Quote:Original post by ricekrispyw
toLua does look nice, but I see nothing about deriving lua classes from C++ classes (or even creating lua classes in the first place...)

I can't find out how to build LuaBind. I'm on WinXP, with VC6. How do I do it? And how much of boost do I need? The entire monstrosity?

Help me, please.

Instead of building it, you can just include the cpp files in your main project.. Obviously, that's not as clean as compiling it into a lib but it works. I'm not sure how much of boost you need, but imo you should just get the whole package anyway, there are a lot of very useful things in there (and I think the headers are enough for luabind, so you don't need to build that either).
Hmmm... OK. Hmmm.

I really don't want the tremendous beast that is boost right now. I realize it's really useful, but I'm not using it, and I would hate to have it just for LuaBind. I have seen nothing else that lets you derive Lua classes from C++ ones (which you can do in LuaBind), so I might not have a choice. Oh, well. Thanks.
The best way to predict the future is to invent it.
LuaBind is very nice, but it is black magic that works but most programmers do not understand how it works. Try to track down where the code that passes parameters between the interpreter and your code, try to understand it, and try to debug it. Very few people really understand what REALLY is going on on LuaBind (or Boost.Python), which means that if you ever need you debug something internally on the glue layer you need to find somebody that can help you out.
Quote:Original post by ricekrispyw
And how much of boost do I need? The entire monstrosity?


From the introduction:

Quote:
It requires boost 1.30.0 to be installed (only boost headers).


I'd hazard that you need only the headers.
-Scoot

This topic is closed to new replies.

Advertisement