Thanks for the reply Max

I found out, the function I looked for is map:get_entities([prefix]), with
"for entity in map:get_entities("your_prefix") do
-- some code related to the entity
end
In my case the switches themself are custom entities, because they behave different from normal switches. And wenn I have several of them in the same room, I also pass down the same function to all of them ^^
But your point is good and brings me to another question

If I have such a collision_test and want to test 2 custom entities, is that still possible? Because like you wrote in target:get_type() == switch, you test if it is an entity of type switch. But when I do target:get_type() == custom_entity, how does it know, that it is the one custom_entity I want and not every custom_entity on the map??
(In my case it would be a collision_test between the custom switch [custom_entity] and a custom_entity created by an item [custom_entity])
Thanks
