queryUtil
A utility for basic query operations.
Types
Connection
EventLike<T>
Functions
query
queryUtil.
query
(
queryResults:
T
,
queryAddition:
EventLike
<
T
>
,
queryRemoving:
EventLike
<
T
>
) →
Property
<
T
>
,
Trove
Returns a property object and a trove. The property object is initially updated with
queryResults
, and then updated based off of queryAddition
and queryRemoving
events
firing off.
local Workspace = game:GetService("Workspace")
local queryResultsProperty, cleanup = queryUtil.query(
Workspace:GetDescendants(),
Workspace.DescendantAdded,
Workspace.DescendantRemoving
)
queryResultsProperty:observe(function(newQueryResults, oldQueryResults)
print(newQueryResults) --> {...} (Array of all Workspace descendants)
end)