The way I do it is, in LevelSetup(), I count (literally or procedurally, depending on how I'm doing the level) how many asteroids there are in the level, then I make a variable called roidnumber equal to that number.
So if I had 10 asteroids in the level, I would do:
roidnumber = 10
Then, during Levelogic(), I can query how many asteroids a particular empire owns, and check if it is the same as roidnumber, or if it is 0.
If it's equal to roidnumber, then that empire owns all of the asteroids in the level.
If it's equal to zero, well... then that empire doesn't own any asteroids.
While GameRunning() do
if GetEmpire(1):GetNumOwnedAsteroids() == 0 then
-- ooh look, no asteroids. player 1 suck and fail!
elseif GetEmpire(1):GetNumOwnedAsteroids() == roidnumber then
-- EPIC WIN, i has all asteroids!
end
coroutine.yield()
end
roidnumber is used for loads and loads of stuff in my scripts. I find it a useful variable to have around.