Actually there is a specific order, and that order is what breaks it. You need it to be the enemy that is closest to the turret. The collision_line function in and of itself is not necessarily bad, but when used in a situation like this it is not adequate. 90% of time it would work because 90% of the time the zombie closest is also the oldest in that lane. But the point of the turret is to attack the nearest enemy in its row, not just any enemy that happens to be there.
Actually, it's going to fail on him more frequently than just 10% of the time, possibly. I just remembered that one of the enemy mechanics in PvZ is some enemies can switch lanes while they are walking. So now you could have a slow enemy walking down the middle lane and then it changes to the Top Lane. Meanwhile you have a fast enemy in the Top Lane that spawned later. None of the turrets in the Top Lane would be able to attack the faster, closer enemy because the slower enemy is older and would be targeted instead.
And even if the function goes after the newest instance rather than the oldest, the situation would still be the same. There would exist a scenario in which the enemy would become temporarily invincible simply by walking past another enemy or changing lanes. So early on in his game designing training, the function would suffice, but as soon as he starts implementing actual challenges to the game play, then it will no longer be adequate.