Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am currently planning how to integrate Lua scripting in my 2D Game Engine, and i would like to go straight to the most adequate solution for having C++ classes and objects exposed.

I've read this (if it helps you help): http://lua-users.org/wiki/BindingCodeToLua

If you have a better scripting language to recomend, go for it ;D

All help is welcome, i need to pickup the best solution to start implementing Thanks

share|improve this question

closed as off-topic by Josh Petrie Apr 21 at 2:19

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about "how to get started," "what to learn next," or "which technology to use" are discussion-oriented questions which involve answers that are either based on opinion, or which are all equally valid. Those kinds of questions are outside the scope of this site. Visit our help center for more information." – Josh Petrie
If this question can be reworded to fit the rules in the help center, please edit the question.

add comment

5 Answers 5

up vote 3 down vote accepted

If the primary quality of your scripting language is easy binding, try AngelScript. It can call registered functions directly without the need to write proxy functions, and it supports calling conventions of wide variety of compilers. The language itself is similar to c/c++, which may be a good or a bad thing, depending.

share|improve this answer
add comment

I've heard good things about LuaPlus. It wraps the low level C API into a higher level C++ one.

share|improve this answer
1  
+1 Thanks for this, something to look into soon :) –  Ray Dey Jan 29 '11 at 15:50
add comment

As long as you're doing reasonably conventional binding, LuaBind will do everything you need. Binding classes and functions tends to be a one-line-per-function deal. If you'd like an example, here's the applicable file from the game engine I've been working on (look for module(L) for the start of the LuaBind interface, DontKillMeBro<> is a little system I rigged up to let me more precisely time object destruction for certain sensitive objects.)

If you want something more complex, you're probably going to need to use the actual Lua API. Luckily, the Lua API is reasonably simple.

share|improve this answer
add comment

I'd go hands down with Nuclex's precompiled libs and include files for LuaBind. (that is if you're working with VS2008)

Since LuaBind requires you to build it with some Boost libs and tools, this package will save you valuable time (and maybe some headache, who knows). I'd say you'd be able to get Lua running in less than an hour if you know what you're doing.

You may also consider changing the default Lua dll to a LuaJIT dll if you're looking for a small performance gain. It's only a matter of compiling the library and replacing the lib/dll you're linking against in your main project, so it's quite easy.

With that, good luck!

share|improve this answer
1  
Lua is not spelled LUA; it is not an acronym. –  pdusen Feb 16 '12 at 18:29
add comment

We're using OOLua for Pioneer. It gives a pile of macros that you use to bind Lua "classes" to C++ classes. Its got a fair bit of power but is pretty straightforward. I haven't used any others so I can't comment on how it compares. Here's an example.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.