Here is my code. I want it to be a circle that gradually gets bigger, but it is not working. Every time it tell it to get bigger (last line, it happens every tenth of a second) it gives me an error saying that spawnedObjects[1].radius is a nil value. However, it can print out spawnedObjects[1].radius on lines 10 and 15 just fine, so it seems that It DOES recognize that the radius is 100, but when I set it as the radius of a new circle, it interprets it as nil. Why is this?
local spawnedObjects = {} local function spawnBubble(bubbleSize) local bubble = display.newCircle(0, 0, bubbleSize) bubble:setFillColor(.5, .5, .5) bubble.radius = bubbleSize -- add bubble to spawnedObjects table for tracking purposes spawnedObjects[#spawnedObjects+1] = bubble print(spawnedObjects[1].radius) end local function circleGrow() --spawnedObjects[1].radius = spawnedObjects[1].radius + 1 print( spawnedObjects[1].radius ) spawnedObjects[1] = display.newCircle(0, 0, spawnedObjects[1].radius) end spawnBubble(100) timer.performWithDelay( 100, circleGrow, 0)
