[ISSUE]invalid 'cobj' in function 'lua_cocos2dx_EventDispatcher_dispatchCustomEvent'

环境: cocos2d-x + lua 3.0beta2

首先声明全局变量

UIEventDispatcher = cc.EventDispatcher:new()

然后在使用的地方dispathCustomEvent

UIEventDispatcher:dispatchCustomEvent("test","test")

但是抛出如题的错误

查看此时 UIEventDispatcher ~= nil

如果在声明的地方马上调用,就没有问题,难道是否自动释放了

在声明的下面加上一句 UIEventDispatcher:retain() 

看来是cocos2d-x的自动释放机制

 

具体原因,待查

posted on 2014-05-03 09:11  影语者  阅读(7588)  评论(0编辑  收藏  举报

导航