Today, I'm trying to figure out the fastest way to get all atoms of a particular type: all the cups, all the players, all the turfs etc.
The way I see it done usually looks like this:
for (var/obj/item_im_looking_for/item in world)
do_stuff_to(item)
Which works, but what if I don't know the path at compile time? What if I'm trying to make a generic 'get list of items' function. Right now, I have this:
var/test_path = text2path(path_as_text)
for (var/item in world)
if(istype(item,test_path)
do_stuff_to(item)
That will work, but I have to imagine that it is considerably slower then the above example.
What's the dm-correct way of doing this kind of dynamic filter?