Add Instance:GetDescendants()

I do not think it’s a good idea.

4 Likes

Are we ever going to get the same methods for WaitForChild?

Every time a new method is added to Instance, there’s a chance it will break someone’s code, for example:

local module = require(script.Modules.GetDescendantsWhichAre)

If there’s a way we can fit more functionality into a single method in a way that makes sense, I think it’s worth considering.

2 Likes

I agree that spamming in new API members is bad, more specifically for bloat than anything else. I agree that an alternative that doesn’t involve API bloat would be worth looking into, though not the previously linked thread because it would increase code bloat in the cases where we’d otherwise make a dedicated feature, and also seems pretty niche (if for pretty code, why don’t you make a module, and if for performance why don’t you organize your instances in a way where you can easily trim what you’re searching down from the beginning?)

1 Like

bLoAtInG

There has to be a better solution here.

2 Likes
2 Likes

Does GetDescendants make any guarantee about order?

I would assumed it’s the same order as GetChildren (it doing a recursive thing), which also doesn’t have a “defined” behaviour (although it’s pretty safe to say it’s in the order the childs got added/replicated)

Yeah, I’m just interested in whether it’s depth-first or breadth-first and whether that ordering is guaranteed

I wrote this in ReflectionMetadata:

Returns an array containing all of the descendants of the instance. Returns in preorder traversal, or in other words, where the parents come before their children, depth first.

But for some reason, the wiki has replaced it with the much less insightful:

Returns an array containing all of the descendants of the instance.
In other words, this returns the children of this instance, and the children of those children, and so on.

I have fixed this.

7 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.