why does this throw a exception?

local levels = {}

function reset()
print(levels[current]["chg"][i]["colorTo"]) -- returns OK!
if(#levels[current]["chg"] > 0) then -- #levels[current]["chg"] OK
for i = 1, #levels[current]["chg"] do
levels[current]["chg"][i]:removeSelf()
end
end
end

local changers1 =
{
{ l=270, t=700, rd=5, r=255, g=0, b=0 ,colorTo='red'},
{ l=540, t=700, rd=5, r=0, g=0, b=255 ,colorTo='blue'},
}

local obstacles1 =
{
{ l=350, t=0, w=10, h=display.contentWidth, r=255, g=0, b=0, myName='wall1',color='red'},
{ l=700, t=0, w=10, h=display.contentWidth, r=0, g=0, b=255, myName='wall2',color='blue'},
}

local wss1 =
{
{ x=10, y=10, w=110, h=110, r=0, red=255, green=0, blue=128, myName='broculos' },
}

table.insert(levels,{chg=changers1,obs=obstacles1,wss=wss1})

reset();

-------------------------
main.lua:88: attempt to call method 'removeSelf' (a nil value)

never mind

views:1385 update:2011/10/6 9:28:12
corona forums © 2003-2011