How to typecast baseclass to superclass in lua

my code as below

function MainMenuUI:configCCB(node)
local playerBtn = node:getChildByTag(3):getChildByTag(1)
CCMenuItem.registerScriptTapHandler(playerBtn,self.onPlayBtnTap)

end


playerBtn is CCNode type,I want to cast to CCMenuItem

thx for any help

Try:

tolua.cast(playerBtn, “CCMenuItem”)

Andre

Andre Arpin wrote:

Try:
>
tolua.cast(playerBtn, “CCMenuItem”)
>
Andre

Thank you very much