Ukendio / jecs

A fast, portable Entity Component System for Luau
https://ukendio.github.io/jecs/
MIT License
146 stars 26 forks source link

[v0.1.0] Iterating `world` after calling `world:delete(entityId)` throws an error #47

Closed knnyism closed 3 months ago

knnyism commented 5 months ago

When an entity is deleted, World.__iter tries getting the archetype of a non-existent sparse array record.

local world = jecs.World.new()

local entity = world:entity()

world:delete(entity)

for e in world do -- jecs:839: attempt to index nil with 'archetype' 

end
Ukendio commented 5 months ago

I have a fix for this. It will be fixed alongside the linked-records-traversal PR

Ukendio commented 3 months ago

This has been fixed in commit https://github.com/Ukendio/jecs/commit/735eb0152664f550be613f8299b1bc5ca1252e76