mirror of
https://github.com/Ukendio/jecs.git
synced 2025-04-25 09:30:03 +00:00
Fix EmptyQuery
This commit is contained in:
parent
41734e37c9
commit
acba47fee2
1 changed files with 12 additions and 7 deletions
19
lib/init.lua
19
lib/init.lua
|
@ -642,16 +642,21 @@ function World.get(world: World, entityId: i53, a: i53, b: i53?, c: i53?, d: i53
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- the less creation the better
|
local function noop() end
|
||||||
local function actualNoOperation() end
|
local function iterNoop(_self: Query, ...: i53): () -> (number, ...any)
|
||||||
local function noop(_self: Query, ...: i53): () -> (number, ...any)
|
return noop :: any
|
||||||
return actualNoOperation :: any
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local EmptyQuery = {
|
local EmptyQuery
|
||||||
__iter = noop;
|
EmptyQuery = {
|
||||||
without = noop;
|
__iter = iterNoop,
|
||||||
|
next = noop,
|
||||||
|
patch = noop,
|
||||||
|
without = function()
|
||||||
|
return EmptyQuery
|
||||||
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
EmptyQuery.__index = EmptyQuery
|
EmptyQuery.__index = EmptyQuery
|
||||||
setmetatable(EmptyQuery, EmptyQuery)
|
setmetatable(EmptyQuery, EmptyQuery)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue