如何将Lua粘合到C ++代码? [英] How do you glue Lua to C++ code?

查看:98
本文介绍了如何将Lua粘合到C ++代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您是否使用Luabind,toLua ++或其他某些程式库(如果有的话,哪一个)或完全不使用?

Do you use Luabind, toLua++, or some other library (if so, which one) or none at all?

对于每种方法, con's?

For each approach, what are the pro's and con's?

推荐答案

我不能真正同意自己投票,绑定基本类型和静态C函数Lua是微不足道的,是的,但图片改变了你开始处理表和metatables的时刻;事情变得很棘手。

I can't really agree with the 'roll your own' vote, binding basic types and static C functions to Lua is trivial, yes, but the picture changes the moment you start dealing with tables and metatables; things go trickier very quickly.

LuaBind似乎在做这项工作,但我有一个哲学问题。对我来说,似乎如果你的类型已经很复杂的事实,Luabind是严重模板不会使你的代码更容易遵循,作为我的一个朋友说你会需要Herb快门来找出编译消息 。此外,它取决于Boost,加上编译时间受到严重打击等。

LuaBind seems to do the job, but I have a philosophical issue with it. For me it seems like if your types are already complicated the fact that Luabind is heavily templated is not going to make your code any easier to follow, as a friend of mine said "you'll need Herb Shutter to figure out the compilation messages". Plus it depends on Boost, plus compilation times get a serious hit, etc.

在尝试几个绑定后,Tolua ++似乎是最好的。 Tolua似乎没有太多的发展,在那里Tolua ++似乎工作得很好(加上一半的Tolua教程,有事实上,Tolua ++教程,相信我:) Tolua确实产生权利

After trying a few bindings, Tolua++ seems the best. Tolua doesn't seem to be very much in development, where as Tolua++ seems to work fine (plus half the 'Tolua' tutorials out there are, in fact, 'Tolua++' tutorials, trust me on that:) Tolua does generate the right stuff, the source can be modified and it seems to deal with complicated cases (like templates, unions, nameless structs, etc, etc)

Tolua ++最大的问题似乎是,它可以被修改,并且它似乎可以处理复杂的情况(如模板,联合,无名结构等)缺乏正确的教程,预先设置的Visual Studio项目,或者命令行有点棘手的事实(你的路径/文件不能有空格 - 在Windows至少 - 等等)仍然,对我来说是赢家。

The biggest issue with Tolua++ seems to be the lack of proper tutorials, pre-set Visual Studio projects, or the fact that the command line is a bit tricky to follow (you path/files can't have white spaces -in Windows at least- and so on) Still, for me it is the winner.

这篇关于如何将Lua粘合到C ++代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆