From 9aa7758fc2a334cdbb417d1fca1e1dfd638ca1ef Mon Sep 17 00:00:00 2001 From: BlackMATov Date: Mon, 17 Mar 2025 15:21:52 +0700 Subject: [PATCH] rename `select` to `components` --- README.md | 2 +- ROADMAP.md | 1 - develop/example.lua | 6 +- develop/untests.lua | 166 ++++++++++++++++++++++---------------------- develop/usbench.lua | 24 +++---- evolved.lua | 56 +++++++-------- 6 files changed, 127 insertions(+), 128 deletions(-) diff --git a/README.md b/README.md index 5788b18..3c8f42d 100644 --- a/README.md +++ b/README.md @@ -98,10 +98,10 @@ batch_multi_insert :: query, fragment[], component[]? -> integer, boolean batch_multi_remove :: query, fragment[] -> integer, boolean chunk :: fragment... -> chunk?, entity[]?, integer? -select :: chunk, fragment... -> component[]... entities :: chunk -> entity[], integer fragments :: chunk -> fragment[], integer +components :: chunk, fragment... -> component[]... each :: entity -> {each_state? -> fragment?, component?}, each_state? execute :: query -> {execute_state? -> chunk?, entity[]?, integer?}, execute_state? diff --git a/ROADMAP.md b/ROADMAP.md index a7bb9c7..0b4b62d 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -3,7 +3,6 @@ ## Backlog - add has, has_all, has_any for chunks -- rename `select` function to `components` ## After first release diff --git a/develop/example.lua b/develop/example.lua index 3c60e86..eb1ae77 100644 --- a/develop/example.lua +++ b/develop/example.lua @@ -60,7 +60,7 @@ local integrate_forces_system = evo.system() evo.get(singles.physics_gravity, singles.physics_gravity) ---@type evolved.vector2[], evolved.vector2[] - local forces, velocities = evo.select(chunk, + local forces, velocities = evo.components(chunk, fragments.force, fragments.velocity) for i = 1, entity_count do @@ -81,7 +81,7 @@ local integrate_velocities_system = evo.system() evo.get(singles.delta_time, singles.delta_time) ---@type evolved.vector2[], evolved.vector2[], evolved.vector2[] - local forces, positions, velocities = evo.select(chunk, + local forces, positions, velocities = evo.components(chunk, fragments.force, fragments.position, fragments.velocity) for i = 1, entity_count do @@ -100,7 +100,7 @@ local graphics_system = evo.system() :query(queries.physics_bodies) :execute(function(chunk, entities, entity_count) ---@type evolved.vector2[] - local positions = evo.select(chunk, + local positions = evo.components(chunk, fragments.position) for i = 1, entity_count do diff --git a/develop/untests.lua b/develop/untests.lua index 6aa8ac5..9ae893f 100644 --- a/develop/untests.lua +++ b/develop/untests.lua @@ -655,7 +655,7 @@ do do local chunk, entities = evo.chunk(f1) assert(entities and entities[1] == e1) - assert(chunk and evo.select(chunk, f1)[1] == 41) + assert(chunk and evo.components(chunk, f1)[1] == 41) end do @@ -667,8 +667,8 @@ do assert(chunk == evo.chunk(f2, f1)) assert(chunk == evo.chunk(f2, f1, f2, f1)) assert(entities and entities[1] == e2 and entities[2] == e2b) - assert(chunk and evo.select(chunk, f1)[1] == 42 and evo.select(chunk, f2)[1] == 43) - assert(chunk and evo.select(chunk, f1)[2] == 44 and evo.select(chunk, f2)[2] == 45) + assert(chunk and evo.components(chunk, f1)[1] == 42 and evo.components(chunk, f2)[1] == 43) + assert(chunk and evo.components(chunk, f1)[2] == 44 and evo.components(chunk, f2)[2] == 45) end do @@ -1969,9 +1969,9 @@ do assert(chunk_entities[1] == e3 and chunk_entities[2] == e1) - assert(#evo.select(chunk, f1) == 0) - assert(#evo.select(chunk, f2) == 0) - assert(evo.select(chunk, f3)[1] == 43 and evo.select(chunk, f3)[2] == 50) + assert(#evo.components(chunk, f1) == 0) + assert(#evo.components(chunk, f2) == 0) + assert(evo.components(chunk, f3)[1] == 43 and evo.components(chunk, f3)[2] == 50) end end end @@ -2010,9 +2010,9 @@ do assert(chunk and chunk_entities) assert(chunk_entities[1] == e1) - assert(#evo.select(chunk, f1) == 0) - assert(#evo.select(chunk, f2) == 0) - assert(#evo.select(chunk, f3) == 0) + assert(#evo.components(chunk, f1) == 0) + assert(#evo.components(chunk, f2) == 0) + assert(#evo.components(chunk, f3) == 0) end do @@ -2020,9 +2020,9 @@ do assert(chunk and chunk_entities) assert(chunk_entities[1] == e3) - assert(#evo.select(chunk, f1) == 0) - assert(#evo.select(chunk, f2) == 0) - assert(evo.select(chunk, f3)[1] == 43) + assert(#evo.components(chunk, f1) == 0) + assert(#evo.components(chunk, f2) == 0) + assert(evo.components(chunk, f3)[1] == 43) end end end @@ -2065,9 +2065,9 @@ do assert(chunk and chunk_entities) assert(next(chunk_entities) == nil) - assert(#evo.select(chunk, f1) == 0) - assert(#evo.select(chunk, f2) == 0) - assert(#evo.select(chunk, f3) == 0) + assert(#evo.components(chunk, f1) == 0) + assert(#evo.components(chunk, f2) == 0) + assert(#evo.components(chunk, f3) == 0) end end end @@ -2110,9 +2110,9 @@ do assert(chunk and chunk_entities) assert(next(chunk_entities) == nil) - assert(#evo.select(chunk, f1) == 0) - assert(#evo.select(chunk, f2) == 0) - assert(#evo.select(chunk, f3) == 0) + assert(#evo.components(chunk, f1) == 0) + assert(#evo.components(chunk, f2) == 0) + assert(#evo.components(chunk, f3) == 0) end end end @@ -2729,7 +2729,7 @@ do do local chunk, entities = evo.chunk(f1, f2) assert(entities and #entities == 1 and entities[1] == e2) - assert(chunk and evo.select(chunk, f2)[1] == 44) + assert(chunk and evo.components(chunk, f2)[1] == 44) end end @@ -2978,13 +2978,13 @@ do do local chunk, entities = evo.chunk(f1, f2, f3) assert(entities and #entities == 1 and entities[1] == e2) - assert(chunk and evo.select(chunk, f2)[1] == 45) + assert(chunk and evo.components(chunk, f2)[1] == 45) end do local chunk, entities = evo.chunk(f3) assert(entities and #entities == 1 and entities[1] == e1) - assert(chunk and evo.select(chunk, f3)[1] == 43) + assert(chunk and evo.components(chunk, f3)[1] == 43) end end end @@ -3890,7 +3890,7 @@ do assert(evo.get(e4, f4) == nil) for chunk in evo.execute(q) do - assert(next(evo.select(chunk, f4)) == nil) + assert(next(evo.components(chunk, f4)) == nil) end do @@ -3898,14 +3898,14 @@ do assert(chunk and entities) assert(#entities == 2) assert(entities[1] == e3, entities[2] == e4) - assert(evo.select(chunk, f2)[1] == 32 and evo.select(chunk, f3)[1] == 33) - assert(evo.select(chunk, f2)[2] == 42 and evo.select(chunk, f3)[2] == 43) + assert(evo.components(chunk, f2)[1] == 32 and evo.components(chunk, f3)[1] == 33) + assert(evo.components(chunk, f2)[2] == 42 and evo.components(chunk, f3)[2] == 43) end do local chunk, entities = evo.chunk(f1, f2, f3, f4) assert(chunk) - assert(next(evo.select(chunk, f4)) == nil) + assert(next(evo.components(chunk, f4)) == nil) assert(#entities == 0) end end @@ -3920,7 +3920,7 @@ do assert(evo.has_all(e4, f2, f3) and not evo.has_any(e4, f1, f4)) for chunk in evo.execute(q) do - assert(next(evo.select(chunk, f1)) == nil) + assert(next(evo.components(chunk, f1)) == nil) end assert(evo.batch_multi_remove(q, { f2, f3 }) == 3) @@ -3930,24 +3930,24 @@ do assert(not evo.has_any(e4, f1, f2, f3, f4)) for chunk in evo.execute(q) do - assert(next(evo.select(chunk, f2)) == nil) - assert(next(evo.select(chunk, f3)) == nil) + assert(next(evo.components(chunk, f2)) == nil) + assert(next(evo.components(chunk, f3)) == nil) end do local chunk, entities = evo.chunk(f1, f2) assert(chunk) - assert(next(evo.select(chunk, f1)) == nil) - assert(next(evo.select(chunk, f2)) == nil) + assert(next(evo.components(chunk, f1)) == nil) + assert(next(evo.components(chunk, f2)) == nil) assert(#entities == 0) end do local chunk, entities = evo.chunk(f1, f2, f3) assert(chunk) - assert(next(evo.select(chunk, f1)) == nil) - assert(next(evo.select(chunk, f2)) == nil) - assert(next(evo.select(chunk, f3)) == nil) + assert(next(evo.components(chunk, f1)) == nil) + assert(next(evo.components(chunk, f2)) == nil) + assert(next(evo.components(chunk, f3)) == nil) assert(#entities == 0) end end @@ -4248,16 +4248,16 @@ do do local c123, c123_es = evo.chunk(f1, f2, f3) assert(c123 and #c123_es == 0) - assert(#evo.select(c123, f1) == 0) - assert(#evo.select(c123, f2) == 0) - assert(#evo.select(c123, f3) == 0) + assert(#evo.components(c123, f1) == 0) + assert(#evo.components(c123, f2) == 0) + assert(#evo.components(c123, f3) == 0) local c1234, c1234_es = evo.chunk(f1, f2, f3, f4) assert(c1234 and #c1234_es == 2) - assert(#evo.select(c1234, f1) == 2) - assert(#evo.select(c1234, f2) == 2) - assert(#evo.select(c1234, f3) == 2) - assert(#evo.select(c1234, f4) == 2) + assert(#evo.components(c1234, f1) == 2) + assert(#evo.components(c1234, f2) == 2) + assert(#evo.components(c1234, f3) == 2) + assert(#evo.components(c1234, f4) == 2) end end @@ -4273,31 +4273,31 @@ do do local c1, c1_es = evo.chunk(f1) assert(c1 and #c1_es == 0) - assert(#evo.select(c1, f1) == 0) + assert(#evo.components(c1, f1) == 0) end do local c12, c12_es = evo.chunk(f1, f2) assert(c12 and #c12_es == 0) - assert(#evo.select(c12, f1) == 0) - assert(#evo.select(c12, f2) == 0) + assert(#evo.components(c12, f1) == 0) + assert(#evo.components(c12, f2) == 0) end do local c134, c134_es = evo.chunk(f1, f3, f4) assert(c134 and #c134_es == 1) - assert(#evo.select(c134, f1) == 1) - assert(#evo.select(c134, f3) == 1) - assert(#evo.select(c134, f4) == 1) + assert(#evo.components(c134, f1) == 1) + assert(#evo.components(c134, f3) == 1) + assert(#evo.components(c134, f4) == 1) end do local c1234, c1234_es = evo.chunk(f1, f2, f3, f4) assert(c1234 and #c1234_es == 3) - assert(#evo.select(c1234, f1) == 3) - assert(#evo.select(c1234, f2) == 3) - assert(#evo.select(c1234, f3) == 3) - assert(#evo.select(c1234, f4) == 3) + assert(#evo.components(c1234, f1) == 3) + assert(#evo.components(c1234, f2) == 3) + assert(#evo.components(c1234, f3) == 3) + assert(#evo.components(c1234, f4) == 3) end end end @@ -4675,14 +4675,14 @@ do do local c12, c12_es = evo.chunk(f1, f2) assert(c12 and #c12_es == 0) - assert(#evo.select(c12, f1) == 0) - assert(#evo.select(c12, f2) == 0) + assert(#evo.components(c12, f1) == 0) + assert(#evo.components(c12, f2) == 0) local c123, c123_es = evo.chunk(f1, f2, f3) assert(c123 and #c123_es == 4) - assert(#evo.select(c123, f1) == 4) - assert(#evo.select(c123, f2) == 4) - assert(#evo.select(c123, f3) == 4) + assert(#evo.components(c123, f1) == 4) + assert(#evo.components(c123, f2) == 4) + assert(#evo.components(c123, f3) == 4) end end @@ -4704,12 +4704,12 @@ do do local c1, c1_es = evo.chunk(f1) assert(c1 and #c1_es == 0) - assert(#evo.select(c1, f1) == 0) + assert(#evo.components(c1, f1) == 0) local c12, c12_es = evo.chunk(f1, f2) assert(c12 and #c12_es == 2) - assert(#evo.select(c12, f1) == 2) - assert(#evo.select(c12, f2) == 2) + assert(#evo.components(c12, f1) == 2) + assert(#evo.components(c12, f2) == 2) end end end @@ -5247,20 +5247,20 @@ do assert(c and es and #es == 1 and es[1] == e) do - local c1, c2 = evo.select(c, f1, f2) + local c1, c2 = evo.components(c, f1, f2) assert(c1 and #c1 == 1 and c1[1] == 1) assert(c2 and #c2 == 1 and c2[1] == 2) end do - local c1, c2, c3 = evo.select(c, f1, f2, f3) + local c1, c2, c3 = evo.components(c, f1, f2, f3) assert(c1 and #c1 == 1 and c1[1] == 1) assert(c2 and #c2 == 1 and c2[1] == 2) assert(c3 and #c3 == 1 and c3[1] == 3) end do - local c1, c2, c3, c4 = evo.select(c, f1, f2, f3, f4) + local c1, c2, c3, c4 = evo.components(c, f1, f2, f3, f4) assert(c1 and #c1 == 1 and c1[1] == 1) assert(c2 and #c2 == 1 and c2[1] == 2) assert(c3 and #c3 == 1 and c3[1] == 3) @@ -5268,7 +5268,7 @@ do end do - local c1, c2, c3, c4, c5 = evo.select(c, f1, f2, f3, f4, f5) + local c1, c2, c3, c4, c5 = evo.components(c, f1, f2, f3, f4, f5) assert(c1 and #c1 == 1 and c1[1] == 1) assert(c2 and #c2 == 1 and c2[1] == 2) assert(c3 and #c3 == 1 and c3[1] == 3) @@ -6460,7 +6460,7 @@ do local c1, c1_es = evo.chunk(f1) assert(c1 and c1_es and #c1_es == 2) assert(c1_es[1] == e1a and c1_es[2] == e1b) - assert(evo.select(c1, f1)[1] == 1 and evo.select(c1, f1)[2] == 11) + assert(evo.components(c1, f1)[1] == 1 and evo.components(c1, f1)[2] == 11) end assert(evo.batch_insert(q1, f2, 2) == 2) @@ -6472,8 +6472,8 @@ do local c12, c12_es = evo.chunk(f1, f2) assert(c12 and c12_es and #c12_es == 2) assert(c12_es[1] == e1a and c12_es[2] == e1b) - assert(evo.select(c12, f1)[1] == 1 and evo.select(c12, f1)[2] == 11) - assert(evo.select(c12, f2)[1] == 2 and evo.select(c12, f2)[2] == 2) + assert(evo.components(c12, f1)[1] == 1 and evo.components(c12, f1)[2] == 11) + assert(evo.components(c12, f2)[1] == 2 and evo.components(c12, f2)[2] == 2) end local e1c = evo.entity():set(f1, 111):build() @@ -6483,7 +6483,7 @@ do local c1, c1_es = evo.chunk(f1) assert(c1 and c1_es and #c1_es == 2) assert(c1_es[1] == e1c and c1_es[2] == e1d) - assert(evo.select(c1, f1)[1] == 111 and evo.select(c1, f1)[2] == 1111) + assert(evo.components(c1, f1)[1] == 111 and evo.components(c1, f1)[2] == 1111) end assert(evo.batch_insert(q1, f2, 22) == 2) @@ -6496,10 +6496,10 @@ do assert(c12 and c12_es and #c12_es == 4) assert(c12_es[1] == e1a and c12_es[2] == e1b) assert(c12_es[3] == e1c and c12_es[4] == e1d) - assert(evo.select(c12, f1)[1] == 1 and evo.select(c12, f1)[2] == 11) - assert(evo.select(c12, f1)[3] == 111 and evo.select(c12, f1)[4] == 1111) - assert(evo.select(c12, f2)[1] == 2 and evo.select(c12, f2)[2] == 2) - assert(evo.select(c12, f2)[3] == 22 and evo.select(c12, f2)[4] == 22) + assert(evo.components(c12, f1)[1] == 1 and evo.components(c12, f1)[2] == 11) + assert(evo.components(c12, f1)[3] == 111 and evo.components(c12, f1)[4] == 1111) + assert(evo.components(c12, f2)[1] == 2 and evo.components(c12, f2)[2] == 2) + assert(evo.components(c12, f2)[3] == 22 and evo.components(c12, f2)[4] == 22) end end @@ -6515,9 +6515,9 @@ do local c123, c123_es = evo.chunk(f1, f2, f3) assert(c123 and c123_es and #c123_es == 2) assert(c123_es[1] == e123a and c123_es[2] == e123b) - assert(evo.select(c123, f1)[1] == 1 and evo.select(c123, f1)[2] == 11) - assert(evo.select(c123, f2)[1] == 2 and evo.select(c123, f2)[2] == 22) - assert(evo.select(c123, f3)[1] == 3 and evo.select(c123, f3)[2] == 33) + assert(evo.components(c123, f1)[1] == 1 and evo.components(c123, f1)[2] == 11) + assert(evo.components(c123, f2)[1] == 2 and evo.components(c123, f2)[2] == 22) + assert(evo.components(c123, f3)[1] == 3 and evo.components(c123, f3)[2] == 33) end assert(evo.batch_remove(q1, f2) == 2) @@ -6526,9 +6526,9 @@ do local c13, c13_es = evo.chunk(f3, f1) assert(c13 and c13_es and #c13_es == 2) assert(c13_es[1] == e123a and c13_es[2] == e123b) - assert(evo.select(c13, f1)[1] == 1 and evo.select(c13, f1)[2] == 11) - assert(evo.select(c13, f2)[1] == nil and evo.select(c13, f2)[2] == nil) - assert(evo.select(c13, f3)[1] == 3 and evo.select(c13, f3)[2] == 33) + assert(evo.components(c13, f1)[1] == 1 and evo.components(c13, f1)[2] == 11) + assert(evo.components(c13, f2)[1] == nil and evo.components(c13, f2)[2] == nil) + assert(evo.components(c13, f3)[1] == 3 and evo.components(c13, f3)[2] == 33) end local e3a = evo.entity():set(f3, 3):build() @@ -6538,7 +6538,7 @@ do local c3, c3_es = evo.chunk(f3) assert(c3 and c3_es and #c3_es == 2) assert(c3_es[1] == e3a and c3_es[2] == e3b) - assert(evo.select(c3, f3)[1] == 3 and evo.select(c3, f3)[2] == 33) + assert(evo.components(c3, f3)[1] == 3 and evo.components(c3, f3)[2] == 33) end assert(evo.batch_remove(q1, f1) == 2) @@ -6548,12 +6548,12 @@ do assert(c3 and c3_es and #c3_es == 4) assert(c3_es[1] == e3a and c3_es[2] == e3b) assert(c3_es[3] == e123a and c3_es[4] == e123b) - assert(evo.select(c3, f1)[1] == nil and evo.select(c3, f1)[2] == nil) - assert(evo.select(c3, f1)[3] == nil and evo.select(c3, f1)[4] == nil) - assert(evo.select(c3, f2)[1] == nil and evo.select(c3, f2)[2] == nil) - assert(evo.select(c3, f2)[3] == nil and evo.select(c3, f2)[4] == nil) - assert(evo.select(c3, f3)[1] == 3 and evo.select(c3, f3)[2] == 33) - assert(evo.select(c3, f3)[3] == 3 and evo.select(c3, f3)[4] == 33) + assert(evo.components(c3, f1)[1] == nil and evo.components(c3, f1)[2] == nil) + assert(evo.components(c3, f1)[3] == nil and evo.components(c3, f1)[4] == nil) + assert(evo.components(c3, f2)[1] == nil and evo.components(c3, f2)[2] == nil) + assert(evo.components(c3, f2)[3] == nil and evo.components(c3, f2)[4] == nil) + assert(evo.components(c3, f3)[1] == 3 and evo.components(c3, f3)[2] == 33) + assert(evo.components(c3, f3)[3] == 3 and evo.components(c3, f3)[4] == 33) end end diff --git a/develop/usbench.lua b/develop/usbench.lua index 41b4df2..47b9f7e 100644 --- a/develop/usbench.lua +++ b/develop/usbench.lua @@ -41,7 +41,7 @@ basics.describe_bench(string.format('Evolved Entity Cycle (Defer): %d entities', evo.defer() do for chunk, entities in evo.execute(A) do - local as = evo.select(chunk, a) + local as = evo.components(chunk, a) for i = 1, #entities do evo.set(evo.id(), b, as[i]) end @@ -70,7 +70,7 @@ basics.describe_bench(string.format('Evolved Entity Cycle (Manual): %d entities' local to_create = {} for chunk, entities in evo.execute(A) do - local as = evo.select(chunk, a) + local as = evo.components(chunk, a) for i = 1, #entities do to_create[#to_create + 1] = as[i] end @@ -144,21 +144,21 @@ basics.describe_bench(string.format('Evolved Simple Iteration: %d entities', N), ---@param CE evolved.query function(a, b, c, d, e, AB, CD, CE) for chunk, entities in evo.execute(AB) do - local as, bs = evo.select(chunk, a, b) + local as, bs = evo.components(chunk, a, b) for i = 1, #entities do as[i], bs[i] = bs[i], as[i] end end for chunk, entities in evo.execute(CD) do - local cs, ds = evo.select(chunk, c, d) + local cs, ds = evo.components(chunk, c, d) for i = 1, #entities do cs[i], ds[i] = ds[i], cs[i] end end for chunk, entities in evo.execute(CE) do - local cs, es = evo.select(chunk, c, e) + local cs, es = evo.components(chunk, c, e) for i = 1, #entities do cs[i], es[i] = es[i], cs[i] end @@ -240,35 +240,35 @@ basics.describe_bench(string.format('Evolved Packed Iteration: %d entities', N), ---@param E evolved.query function(a, b, c, d, e, A, B, C, D, E) for chunk, entities in evo.execute(A) do - local as = evo.select(chunk, a) + local as = evo.components(chunk, a) for i = 1, #entities do as[i] = as[i] * 2 end end for chunk, entities in evo.execute(B) do - local bs = evo.select(chunk, b) + local bs = evo.components(chunk, b) for i = 1, #entities do bs[i] = bs[i] * 2 end end for chunk, entities in evo.execute(C) do - local cs = evo.select(chunk, c) + local cs = evo.components(chunk, c) for i = 1, #entities do cs[i] = cs[i] * 2 end end for chunk, entities in evo.execute(D) do - local ds = evo.select(chunk, d) + local ds = evo.components(chunk, d) for i = 1, #entities do ds[i] = ds[i] * 2 end end for chunk, entities in evo.execute(E) do - local es = evo.select(chunk, e) + local es = evo.components(chunk, e) for i = 1, #entities do es[i] = es[i] * 2 end @@ -335,14 +335,14 @@ basics.describe_bench(string.format('Evolved Fragmented Iteration: %d entities', ---@param Last evolved.query function(data, last, Data, Last) for chunk, entities in evo.execute(Data) do - local ds = evo.select(chunk, data) + local ds = evo.components(chunk, data) for i = 1, #entities do ds[i] = ds[i] * 2 end end for chunk, entities in evo.execute(Last) do - local ls = evo.select(chunk, last) + local ls = evo.components(chunk, last) for i = 1, #entities do ls[i] = ls[i] * 2 end diff --git a/evolved.lua b/evolved.lua index 8d16505..108d553 100644 --- a/evolved.lua +++ b/evolved.lua @@ -672,9 +672,9 @@ local __evolved_batch_multi_insert local __evolved_batch_multi_remove local __evolved_chunk -local __evolved_select local __evolved_entities local __evolved_fragments +local __evolved_components local __evolved_each local __evolved_execute @@ -7017,11 +7017,35 @@ __evolved_chunk = function(...) return chunk, chunk.__entity_list, chunk.__entity_count end +---@param chunk evolved.chunk +---@return evolved.entity[] entity_list +---@return integer entity_count +---@nodiscard +__evolved_entities = function(chunk) + if __debug_mode then + __validate_chunk(chunk) + end + + return chunk.__entity_list, chunk.__entity_count +end + +---@param chunk evolved.chunk +---@return evolved.fragment[] fragments +---@return integer fragment_count +---@nodiscard +__evolved_fragments = function(chunk) + if __debug_mode then + __validate_chunk(chunk) + end + + return chunk.__fragment_list, chunk.__fragment_count +end + ---@param chunk evolved.chunk ---@param ... evolved.fragment fragments ---@return evolved.storage ... storages ---@nodiscard -__evolved_select = function(chunk, ...) +__evolved_components = function(chunk, ...) local fragment_count = __lua_select('#', ...) if fragment_count == 0 then @@ -7080,34 +7104,10 @@ __evolved_select = function(chunk, ...) i2 and storages[i2] or empty_component_storage, i3 and storages[i3] or empty_component_storage, i4 and storages[i4] or empty_component_storage, - __evolved_select(chunk, __lua_select(5, ...)) + __evolved_components(chunk, __lua_select(5, ...)) end end ----@param chunk evolved.chunk ----@return evolved.entity[] entity_list ----@return integer entity_count ----@nodiscard -__evolved_entities = function(chunk) - if __debug_mode then - __validate_chunk(chunk) - end - - return chunk.__entity_list, chunk.__entity_count -end - ----@param chunk evolved.chunk ----@return evolved.fragment[] fragments ----@return integer fragment_count ----@nodiscard -__evolved_fragments = function(chunk) - if __debug_mode then - __validate_chunk(chunk) - end - - return chunk.__fragment_list, chunk.__fragment_count -end - ---@param entity evolved.entity ---@return evolved.each_iterator iterator ---@return evolved.each_state? iterator_state @@ -8492,10 +8492,10 @@ evolved.batch_multi_insert = __evolved_batch_multi_insert evolved.batch_multi_remove = __evolved_batch_multi_remove evolved.chunk = __evolved_chunk -evolved.select = __evolved_select evolved.entities = __evolved_entities evolved.fragments = __evolved_fragments +evolved.components = __evolved_components evolved.each = __evolved_each evolved.execute = __evolved_execute