local group = display.newGroup( ) local image = display.newRect( 100, 100, 100, 100 ) group:insert( image ) for i=group.numChildren, 1, -1 do display.remove( group[i] ) group[i] = nil end function generate() group:insert( image ) end -- timer.performWithDelay( 1000, generate ) -- bad argument #-2 to 'insert' (Proxy expected, got nil) generate() -- work well
Can anyone please explain why the “timer.performWithDelay” code is wrong?
How can I insert the image into the group after a time I want?