游戏开发论坛

 找回密码
 立即注册
搜索
查看: 2084|回复: 4

推荐LUABIND

[复制链接]

28

主题

685

帖子

703

积分

高级会员

Rank: 4

积分
703
发表于 2004-9-5 07:56:00 | 显示全部楼层 |阅读模式
也许你正在使用LUA。
那为什么不试一下LUABIND呢?
开源,
支持的编译器:
Visual Studio 7.1
Visual Studio 7.0
Visual Studio 6.0 (sp 5)
Intel C++ 6.0 (Windows)
GCC 2.95.3 (cygwin)
GCC 3.0.4 (Debian/Linux)
GCC 3.1 (SunOS 5.8)
GCC 3.2 (cygwin)

28

主题

685

帖子

703

积分

高级会员

Rank: 4

积分
703
 楼主| 发表于 2004-9-5 07:57:00 | 显示全部楼层

Re:推荐LUABIND

绑定函数:
module(L)
[
        def("sin", &std::sin)
];

绑定重载函数:
module(L)
[
        def("f", (int(*)(const char*)) &f),
        def("f", (void(*)(int)) &f)
];
绑定类:
class testclass
{
public:
        testclass(const std::string& s): m_string(s) {}
        void print_string() { std::cout << m_string << "\n"; }
private:
        std::string m_string;
};
To register it with a lua environment, write as follows (assuming you are using namespace luabind):

module(L)
[
        class_<testclass>("testclass")
                .def(constructor<const std::string&>())
                .def("print_string", &testclass::print_string)
];

详情请参见www.sf.net上有关项目

29

主题

421

帖子

436

积分

中级会员

Rank: 3Rank: 3

积分
436
发表于 2004-9-5 11:05:00 | 显示全部楼层

Re: 推荐LUABIND

再给个更加详细的地址吧。上个地址去了错误。

28

主题

685

帖子

703

积分

高级会员

Rank: 4

积分
703
 楼主| 发表于 2004-9-5 11:13:00 | 显示全部楼层

Re:推荐LUABIND

文档:
http://luabind.sourceforge.net/docs.html
网站luabind.sf.net/
现在sf.net正在维护,下午估计就能上去下载了。

55

主题

175

帖子

193

积分

注册会员

Rank: 2

积分
193
发表于 2004-9-5 17:11:00 | 显示全部楼层

Re:推荐LUABIND

呵呵,我一直用它。
不过,还有个类似功能的toLua开源库,不知比之luaBind如何.
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2025-8-18 02:01

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表