-- Title: Mark all D stars

function mark_spectraltype(x)
    local obs = celestia:getobserver()
    local nstars = celestia:getstarcount()
    local i = 0
--    while i < nstars do
--        star = celestia:getstar(i)
    for star in celestia:stars() do
        first, last = string.find(star:spectraltype(), x, 1, true)
        if first == 1 then
            star:mark("#ff99ff", "triangle", 10)
        end
        i = i + 1
    end
end

spectral = "D"
celestia:flash("Marking all " .. spectral .. " stars.")
mark_spectraltype(spectral)

