Compare commits

...

10 commits

Author SHA1 Message Date
EncodedVenom
495f95d35e
Merge acc6e40aed into bce46bc93f 2025-01-15 13:05:29 +01:00
Laud Boateng
bce46bc93f
Fix World Each to iterate multiple archetypes (#174)
* Add tests for entity-child relationships and removal in world queries, fixed world_each

* Correct test case

---------

Co-authored-by: Marcus <ukendio@gmail.com>
2025-01-15 13:03:28 +01:00
EncodedVenom
acc6e40aed Simplify script maybe? 2024-10-19 20:04:29 -04:00
EncodedVenom
9878df20ba Use bash entirely 2024-10-19 20:02:05 -04:00
EncodedVenom
b365fc8c1c Parenthesis 2024-10-19 19:58:09 -04:00
EncodedVenom
a8004011cc change to file 2024-10-19 19:55:54 -04:00
EncodedVenom
c697030ec4 debug 2024-10-19 19:53:43 -04:00
EncodedVenom
fefbd19b38 get around permissions 2024-10-19 19:52:21 -04:00
EncodedVenom
d5dc64be1b change location 2024-10-19 19:49:13 -04:00
EncodedVenom
04ef154193 Unit testing init PR 2024-10-19 19:47:26 -04:00
4 changed files with 41 additions and 7 deletions

View file

@ -16,4 +16,5 @@ jobs:
- name: Analyze
run: |
output=$(luau-analyze src || true) # Suppress errors for now.
(luau-analyze src || true) > analyze-log.txt # Suppress errors for now.
bash ./scripts/gh-warn-luau-analyze.sh analyze-log.txt

View file

@ -1995,6 +1995,7 @@ local function world_each(world: World, id): () -> ()
archetype = archetypes[archetype_id]
entities = archetype.entities
row = #entities
entity = entities[row]
end
row -= 1
return entity

View file

@ -0,0 +1,13 @@
# Read the input file line by line
while IFS= read -r line; do
# Use regex to capture file name, line number, column number, and message
if [[ $line =~ ^(.+)\(([0-9]+),([0-9]+)\):\ (.+)$ ]]; then
file="${BASH_REMATCH[1]}"
line_number="${BASH_REMATCH[2]}"
column_number="${BASH_REMATCH[3]}"
message="${BASH_REMATCH[4]}"
# Format output for GitHub Actions
echo "::warning file=$file,line=$line_number,col=$column_number::${message}"
fi
done < "$1"

View file

@ -900,20 +900,39 @@ end)
TEST("world:children", function()
local world = world_new()
local e1 = world:entity()
local e2 = world:entity()
local e3 = world:entity()
local C = world:component()
local T = world:entity()
local e1 = world:entity()
world:set(e1, C, true)
local e2 = world:entity()
world:add(e2, T)
world:add(e2, pair(ChildOf, e1))
local e3 = world:entity()
world:add(e3, pair(ChildOf, e1))
for entity in world:children(pair(ChildOf, e1)) do
local count = 0
for entity in world:children(e1) do
count += 1
if entity == e2 or entity == e3 then
CHECK(true)
continue
end
CHECK(false)
end
CHECK(count == 2)
world:remove(e2, pair(ChildOf, e1))
count = 0
for entity in world:children(e1) do
count += 1
end
CHECK(count == 1)
end)
TEST("world:clear()", function()
@ -1562,9 +1581,9 @@ TEST("repro", function()
local world = world_new()
local component1 = world:component()
local tag1 = world:entity()
local query = world:query(component1):with(tag1):cached()
local entity = world:entity()
world:set(entity, component1, "some data")