about CCTableViewCell autorelease question on lua

Hi,developers…

I notice that the CCTableViewCell need autorelease like this (cpp testproject’s code )

 CCTableViewCell *cell = table->dequeueCell();
    if (!cell) {
        cell = new CustomTableViewCell();
        cell->autorelease();
        CCSprite *sprite = CCSprite::create("Images/Icon.png");
        sprite->setAnchorPoint(CCPointZero);
        sprite->setPosition(ccp(0, 0));
        cell->addChild(sprite);
}

however, I also notice that CCTableViewCell can’t call autorelease method in lua project, like this (lua testproject’s code )

local cell = table:dequeueCell()
    local label = nil
    if nil == cell then
        cell = CCTableViewCell:new()
        local sprite = CCSprite:create("Images/Icon.png")
        sprite:setAnchorPoint(CCPointMake(0,0))
        sprite:setPosition(CCPointMake(0, 0))
        cell:addChild(sprite)
}

when I try to add the autorelease in lua ,cell:autorelease();, the game will crash ,
Do we need autorelease in lua ? why not ?

thank you for your answers…

@junfeng lee
Please post lua related issues into lua sub-forum in future.
Thanks.

Which version are you using?In v3.0, TableViewCell’s new function would call autorelease in the internal.

local cell = table:dequeueCell()
local label = nil
if nil == cell then
cell = CCTableViewCell:new()
local sprite = CCSprite:create(“Images/Icon.png”)
sprite:setAnchorPoint(CCPointMake(0,0))
sprite:setPosition(CCPointMake(0, 0))
cell:addChild(sprite)
}

--Where and how did these codes use?

@samuele3hu i am using 2.2.2 ,the sample code also in 2.2.2’s lua test

In the V2.2.2, the new function bound to lua already contained autorelease,the detailed info you can see the tolua_Cocos2d_CCTableViewCell_new.