Skip to content

Commit

Permalink
Add within tags
Browse files Browse the repository at this point in the history
  • Loading branch information
memorycode committed Oct 20, 2024
1 parent 2a8a862 commit ce8e048
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/World.luau
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ end
@param id number -- The entity ID
@return bool -- `true` if the entity exists
]=]
function World.contains(self: typeof(World.new()), id)
function World:contains(id)
return self.allEntities[id] ~= nil
end

Expand Down Expand Up @@ -678,6 +678,8 @@ function QueryResult.new(compatibleArchetypes: { Archetype }, queryLength: numbe

local entityId: number
--[=[
@within QueryResult
Returns the next set of values from the query result. Once all results have been returned, the
QueryResult is exhausted and is no longer useful.
Expand Down Expand Up @@ -774,6 +776,8 @@ function QueryResult.new(compatibleArchetypes: { Archetype }, queryLength: numbe
end

--[=[
@within QueryResult
Returns an iterator that will skip any entities that also have the given components.
The filtering is done at the archetype level, and so it is faster than manually skipping entities.
Expand Down Expand Up @@ -838,6 +842,8 @@ function QueryResult.new(compatibleArchetypes: { Archetype }, queryLength: numbe
}

--[=[
@within QueryResult
Creates a "snapshot" of this query, draining this QueryResult and returning a list containing all of its results.
By default, iterating over a QueryResult happens in "real time": it iterates over the actual data in the ECS, so
Expand Down Expand Up @@ -878,6 +884,8 @@ function QueryResult.new(compatibleArchetypes: { Archetype }, queryLength: numbe
end

--[=[
@class View
Creates a View of the query and does all of the iterator tasks at once at an amortized cost.
This is used for many repeated random access to an entity. If you only need to iterate, just use a query.
Expand All @@ -904,6 +912,8 @@ function QueryResult.new(compatibleArchetypes: { Archetype }, queryLength: numbe
end

--[=[
@within View
Retrieve the query results to corresponding `entity`
@param entity number - the entity ID
@return ...ComponentInstance
Expand All @@ -918,6 +928,8 @@ function QueryResult.new(compatibleArchetypes: { Archetype }, queryLength: numbe
end

--[=[
@within View
Equivalent to `world:contains()`
@param entity number - the entity ID
@return boolean
Expand Down

0 comments on commit ce8e048

Please sign in to comment.