Skip to content

Commit

Permalink
Merge branch 'query-iter' of https://github.com/matter-ecs/matter int…
Browse files Browse the repository at this point in the history
…o archetype-negation
  • Loading branch information
Ukendio committed Feb 9, 2024
2 parents 8bd0249 + 287e7ac commit e16f89a
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions lib/World.lua
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,21 @@ function World:get(id, ...)
return unpack(components, 1, length)
end

local function noop() end

local noopQuery = setmetatable({
next = noop,
snapshot = noop,
without = function(self)
return self
end,
view = noop,
}, {
__iter = function()
return noop
end,
})

--[=[
Performs a query against the entities in this World. Returns a [QueryResult](/api/QueryResult), which iterates over
the results of the query.
Expand All @@ -410,21 +425,6 @@ end
@return QueryResult -- See [QueryResult](/api/QueryResult) docs.
]=]

local function noop() end

local noopQuery = setmetatable({
next = noop,
snapshot = noop,
without = function(self)
return self
end,
view = noop,
}, {
__iter = function()
return noop
end,
})

function World:query(...)
debug.profilebegin("World:query")
assertValidComponent((...), 1)
Expand Down Expand Up @@ -486,7 +486,7 @@ function World:query(...)
self:_markStorageDirty()
end

return QueryResult.new(self, expand, archetype, compatibleArchetypes)
return QueryResult.new(self, expand, compatibleArchetypes)
end

local function cleanupQueryChanged(hookState)
Expand Down

0 comments on commit e16f89a

Please sign in to comment.