分享LuaProxy 在Lua里使用extensions (ccbi/scroll/table) 2013-4-8更新

1004
E:cocos2dx-hotfixcocos2d-2.1rc0-x-2.1.2scriptingluacocos2dx-LuaProxy-master这个是本地目录,请问我这么添加对吗,现在是vs2012找不到文件,谢谢告知

— Begin quote from ____

hyq1017 发表于 2013-4-20 10:38 url

E:cocos2dx-hotfixcocos2d-2.1rc0-x-2.1.2scriptingluacocos2dx-LuaProxy-master这个是本地目录,请 …

— End quote

![](file:///C:UsersfwwAppDataRoamingTencentUsers363712058QQWinTempRichOleI0RKI5COGF~81CH0BO`{B(X.jpg)
1005

— Begin quote from ____

feiben 发表于 2013-3-28 14:21 url

我添加了LuaProxy和LuaProxy olua和LuaProxyui,3个目录都加进去了,编辑器里是能找到方法的,但是生成 …

— End quote

问题解决了吗,我也碰到这个问题,不太会导入,谢谢告知{:soso_e100:}

— Begin quote from ____

feiben 发表于 2013-3-28 13:51 url

我在2.1.2中没有跑起来,很多编译错误
在2.1.1中,加入luaopen_LuaProxy(pEngine->getLuaState());后报错:

— End quote

我也遇到这个问题了,请问你解决了吗,{:soso_e100:}

刚才在英文论坛里看到了,原来是中国人做的呀;P 最近正在搜集这个资料 太感谢了!

还是不行,改到吐了
Undefined symbols for architecture i386:
“cocos2d::extension::CCBSequence::getDuration()”, referenced from:
__ZL29tolua_CCBSequence_getDurationP9lua_State in luaopen_LuaProxy.o
“cocos2d::extension::CCBSequence::setDuration(float)”, referenced from:
__ZL29tolua_CCBSequence_setDurationP9lua_State in luaopen_LuaProxy.o
“cocos2d::extension::CCBSequence::getSequenceId()”, referenced from:

  • 本帖最后由 feiben 于 2013-3-28 14:39 编辑 *

— Begin quote from ____

Shawn和月 发表于 2013-3-28 14:18 url

这种问题经常是没有添加头文件搜索路径。
不仅仅要把头文件引入工程,还要在项目设置里添加头文件引用,除 …

— End quote

我添加了LuaProxy和LuaProxy olua和LuaProxyui,3个目录都加进去了,编辑器里是能找到方法的,但是生成的时候提示这个错误

“项目设置里添加头文件引用”指的是“附加包含目录”吧?

我又测试了下,放在AppDelegate目录下,还是报错了。。。难道我的vs环境有问题?

我在2.1.2中没有跑起来,很多编译错误
在2.1.1中,加入luaopen_LuaProxy(pEngine->getLuaState());后报错:
error LNK2019: 无法解析的外部符号 “int __cdecl luaopen_LuaProxy(struct lua_State *)” (?luaopen_LuaProxy@@YAHPAUlua_State@@@Z),该符号在函数 “public: virtual bool __thiscall AppDelegate::applicationDidFinishLaunching(void)” (?applicationDidFinishLaunching@AppDelegate@@UAE_NXZ) 中被引用

上面包含了#include “tolua/luaopen_LuaProxy.h”,不知道为什么报的这个错

哦,看到兄台此贴,明白你说的extension指啥了,多谢。

楼主很棒,支持 + 鼓励

— Begin quote from ____

Shawn和月 发表于 2013-4-23 09:40 url

链接时的这个错误一般是没添加某些静态链接库,这些是我的工程里的,你可以参考。

libcocos2d.lib

— End quote

1017
这是我的静态库,还是不行{:soso_e136:}

— Begin quote from ____

Shawn和月 发表于 2013-4-23 09:40 url

链接时的这个错误一般是没添加某些静态链接库,这些是我的工程里的,你可以参考。

libcocos2d.lib

— End quote

可以了,是因为我源文件没添加到vs中,之前以为把文件放在工程目录下就行了,呵呵谢谢指导

ccbi文件是cocosbuilder产生的,我是win7怎么产生那个文件呢,cocos2d-x是怎么样用的呢?

— Begin quote from ____

Shawn和月 发表于 2013-4-20 22:45 url

把cocos2dx-LuaProxy-master的tolua和ui中的所有源文件加入到你的工程中,包含目录不用写tolua和ui两个。在 …

— End quote

不好意思刚看到回复,路径我重新添加了,$(ProjectDir)…cocos2dx-LuaProxy-master,然后在#include “tolua/luaopen_LuaProxy.h”,luaopen_LuaProxy(pEngine->getLuaStack()->getLuaState());但是生成时出现错误AppDelegate.obj : error LNK2019: 无法解析的外部符号 “int __cdecl luaopen_LuaProxy(struct lua_State *)” (?luaopen_LuaProxy@@YAHPAUlua_State@@@Z),该符号在函数 “public: virtual bool __thiscall AppDelegate::applicationDidFinishLaunching(void)” (?applicationDidFinishLaunching@AppDelegate@@UAE_NXZ) 中被引用,这个是怎么回事啊

— Begin quote from ____

Shawn和月 发表于 2013-3-28 15:47 url

用CCTableView就行,LUA里可以用LuaProxy里的LuaTableView(对CCTableView做了小扩展),例子可以在github …

— End quote

新手 看不懂,求指教{:soso_e154:}

README 表示许多同学都会看不懂,没有具体的实例。楼主能给个具体的lua实例demo吗?让我们放在项目里便能直接运行,你readme里面的东西根本看不懂。

local h = LuaEventHandler:createWithFunction(function(fn, table, a1, a2)
local r
if fn == “cellSize” then
– Return cell size
r = CCSizeMake(320,100)
elseif fn == “cellAtIndex” then
– Return CCTableViewCell, a1 is cell index, a2 is dequeued cell (maybe nil)
– Do something to create cell and change the content
elseif fn == “numberOfCells”
– Return number of cells
r = 100
elseif fn == “cellTouched” then
– A cell was touched, a1 is cell that be touched. This is not necessary.
end
return r
end

— Begin quote from ____

Rank 发表于 2013-3-28 20:54 url

local h = LuaEventHandler:createWithFunction(function(fn, table, a1, a2)
local r
if fn == "cellS …

— End quote

这些都是什么意思哦,不能直接用

请问有自己DIY lua接口函数的教程么 我用引擎自带的pkg原封不动 tolua++生成的没有用

正好使用lua进行开发 需要使用到listview 我cocos2d-x 2.0.4版本可以用吗? lua中具体怎么调用楼主能给个demo么? 跪求:(