Bug in 0.12 lua bindings

Bug in 0.12 lua bindings
0.0 0


It looks like the new Lua bindings with 0.12 have introduced some issues with super classes not reporting correctly. From what I understand, as classes are registered (via tolua_cclass), all the super classes are registered as well (via mapsuper).

However, in the most recent version of LuaCocos2d, it looks like it’s not guaranteed that the parent class of certain CCObjects are registered before their children. Specifically the issue I’ve found is that


is now before


What this means is when you try and do something like this:

label = CCLabelTTF:labelWithString("Test Label", "Marker Felt", 16.0) layerGame:addChild(label)

The inner c code will fail checking the argument:

!tolua_isusertype(tolua_S,2,"CCNode",0,&tolua_err) ||

Because CCNode hasn’t been added in the class hierarchy. Unfortunately this makes many of the cocos objects unusable with the lua bindings :frowning:

Is anyone else experiencing this behavior? If so, it would be great to get the LuaCocos2d.cpp file regenerated with explicit ordering as it seemed to before. At the least, git history says that these were ordered correctly before :slight_smile:




Looks like this works as a workaround, but it’s sloppy and easy to miss / cause errors…

layerGame:addChild(tolua.cast(label, "CCNode"), 0, 1) label = layerGame:getChildByTag(1) label = tolua.cast(label, "CCLabelTTF")


thanks, i’m working for this bug :slight_smile: