Reduce indexing

This commit is contained in:
Ukendio 2024-07-29 13:59:48 +02:00
parent 87e986b6aa
commit ff54fb3d62

View file

@ -743,6 +743,8 @@ do
local compatible_archetypes: { Archetype } local compatible_archetypes: { Archetype }
local column_indices: { { number} } local column_indices: { { number} }
local ids: { number } local ids: { number }
local tr
local columns
local function world_query_next(): any local function world_query_next(): any
local entityId = entities[i] local entityId = entities[i]
@ -752,6 +754,8 @@ do
if not archetype then if not archetype then
return nil return nil
end end
tr = column_indices[lastArchetype]
columns = archetype.columns
entities = archetype.entities entities = archetype.entities
i = #entities i = #entities
entityId = entities[i] entityId = entities[i]
@ -760,9 +764,6 @@ do
local row = i local row = i
i-=1 i-=1
local columns = archetype.columns
local tr = column_indices[lastArchetype]
if queryLength == 1 then if queryLength == 1 then
return entityId, columns[tr[1]][row] return entityId, columns[tr[1]][row]
elseif queryLength == 2 then elseif queryLength == 2 then
@ -1012,6 +1013,8 @@ do
entities = archetype.entities entities = archetype.entities
i = #entities i = #entities
tr = column_indices[lastArchetype]
columns = archetype.columns
return it return it
end end