Make it static

This commit is contained in:
Ukendio 2024-07-28 12:33:38 +02:00
parent 48990ad910
commit 18ead3ed19
2 changed files with 22 additions and 23 deletions

View file

@ -57,7 +57,7 @@ local function flip()
end
local common = 0
local N = 2^16-2
local N = 500
local archetypes = {}
local hm = 0
@ -170,20 +170,19 @@ return {
end,
Functions = {
ECR = function()
local matched = 0
for entityId, firstComponent in registry2:view(B1, B4) do
matched += 1
Mirror = function()
for i = 1, 1000 do
for entityId, firstComponent in mcs:query(E1, E4) do
end
end
end,
Jecs = function()
local matched = 0
for i = 1, 1000 do
for entityId, firstComponent in ecs:query(D1, D4) do
matched += 1
end
end
end,
},
}

View file

@ -921,6 +921,19 @@ do
return query
end
local it = {
__iter = world_query_iter,
next = world_query_next,
with = world_query_with,
without = world_query_without,
replace = world_query_replace,
archetypes = function()
return compatible_archetypes
end
} :: any
setmetatable(it, it)
function world_query(world: World, ...: any): Query
-- breaking?
if (...) == nil then
@ -990,19 +1003,6 @@ do
entities = archetype.entities
i = #entities
local it = {
__iter = world_query_iter,
next = world_query_next,
with = world_query_with,
without = world_query_without,
replace = world_query_replace,
archetypes = function()
return compatible_archetypes
end
} :: any
setmetatable(it, it)
return it
end
end