...
...
...
Heh, but the Asteroid ID's in the game starts at 0, and you don't wanna miss any of them? And it'll run a nil roid at the end, so it would be catastrophic!
Ask any programmer, things in the PC world starts with 0 usually, but Lua's arrays are intended to start at 1 so humans can easily pick it up I guess 
Not the problem, because it's not what I am doing in the code.
In the code, I am looping through all empires(which start by zero), and using the GetNumOwnedAsteroids built-in, which returns the number of asteroids.
i.e.
Empire 0 has 2 roids / Empire 1 has 7 roids / Empire 2 has 6 roids
GetNumFactions will return 3, so I need to loop between 0 and the last empire(which is GetNumFactions() - 1, because indeed it starts at zero)
numberOfRoids = numberOfRoids + GetEmpire(empireID):GetNumOwnedAsteroids()This on the first run will return 2
On the second it will return 2 + 7 = 9
On the third run it will run 9 + 6 = 15
And in the end returns the last result, which is 15.(What I am not entirely sure, is if empty asteroids have a empire assigned to them. If not, this won't work...)