Changes
generalize enemy iterators
-- * Enemy iterators.
-- * Enemy iterators.
function Iterator.enemiesByType(context, n)
function Iterator.enemiesBy(context, n, pred, pre)
local collection = U.imap(CollectionEnemy, function(name)
local collection = U.imap(CollectionEnemy, function(name)
return EnemyShip(name)
return EnemyShip(name)
end
end
end)
end)
local i = 1
local i = 1
local current = nil
local current = nil
end,
end,
}
}
end
function Iterator.enemiesByType(context, n)
local type = numberKey('type', context, n)
return Iterator.enemiesBy(context, n, function(e)
return e:type() == type
end)
end
end