Replies: 5 comments 4 replies
-
|
One concern is that this function could be super expensive, or return strange types that people don't know how to handle. I think we should make getElements() -- ❌ not allowed, filter spec required
getElements({}) -- ❌ not allowed, searchRoot and filterTypes are required
getElements({searchRoot = root, filterTypes={"vehicle"}}) -- ✅ equivalent to getElementsByType("vehicle")
getElements({searchRoot = root, filterTypes={}}) -- It should return nothing |
Beta Was this translation helpful? Give feedback.
-
|
How should recursion work?
|
Beta Was this translation helpful? Give feedback.
-
|
I think you don't need backwards compatibility with getElementsByType, getElements is a different new function that can work in its own way with defaults for ease of use. |
Beta Was this translation helpful? Give feedback.
-
|
It might as well also have a range arg like getElementsWithinRange |
Beta Was this translation helpful? Give feedback.
-
|
filtering should support position, resource, model |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
People want an efficient way to get all elements matching a particular set of filters (e.g. on screen only in #4746), that doesn't involve looping over all elements in Lua and performing expensive checks.
I propose an expressive API that can be expanded to additional use cases in the future.
Prior art
getElementsByType(string theType, [element startat=getRootElement(), bool streamedIn=false])How to roll this out
We should start simple and not try to do too much at once, especially so we can address @ArranTuna's needs in #4746 sooner rather than later.
Beta Was this translation helpful? Give feedback.
All reactions