Spawn funtion

function sCoelhosB() for i =1, level do spawnT[i] = spawnB() print(spawnT[i]) end end

I have this function for respaw, and i call on this function below

function goGame(event) display.remove(event.target) display.remove(titulo) display.remove(highScoreText) display.remove(scoreText) display.remove(qtdCoelhosText) display.remove(gameOvertext) display.remove( levelText ) display.remove(arvores) scoreText = display.newText(" 0 ", 0,0, "Helvetica", 22) scoreText.x = centerX scoreText.y = 15 scoreText.text = score levelText = display.newText("Level: 1", 0,0, "Helvetica", 22) levelText.x = centerX /2 levelText.y = 15 levelText.text = "Level: "..level qtdCoelhosText = display.newText( "Coelhos: 10", 0, 0, "Helvetica", 22 ) qtdCoelhosText.x = centerX +130 qtdCoelhosText.y = 15 qtdCoelhosText.text = "Coelhos: "..coelhoNivel if coelhoNivel \>=1 then if math.random(10) \<= 8 then spawnT[level] = spawnB() else spawnT[level] = spawnM() end end return true end

But when i kill one enemy, then go back to gogame and call a respawn funtion again, now how i wait destroy all enemys before call a function again??