mirror of
https://github.com/Ukendio/jecs.git
synced 2025-04-25 09:30:03 +00:00
Fixes
This commit is contained in:
parent
bd6eab315f
commit
faf9b365cf
1 changed files with 30 additions and 33 deletions
11
lib/init.lua
11
lib/init.lua
|
@ -114,9 +114,8 @@ local function ECS_GENERATION_INC(e: i53)
|
|||
local generation = flags % ECS_GENERATION_MASK
|
||||
|
||||
return ECS_COMBINE(id, generation + 1) + flags
|
||||
else
|
||||
return ECS_COMBINE(e, 1)
|
||||
end
|
||||
return ECS_COMBINE(e, 1)
|
||||
end
|
||||
|
||||
-- FIRST gets the high ID
|
||||
|
@ -834,8 +833,7 @@ function World.__iter(world: World): WorldIterator
|
|||
|
||||
-- new solver doesnt like the world iterator type even tho its correct
|
||||
-- so any cast here i come
|
||||
local iterator: WorldIterator = (
|
||||
function()
|
||||
local function iterator()
|
||||
local lastEntity: number?, entityId: number = next(dense, last)
|
||||
if not lastEntity then
|
||||
-- ignore type error
|
||||
|
@ -863,12 +861,11 @@ function World.__iter(world: World): WorldIterator
|
|||
|
||||
return entityId, entityData
|
||||
end
|
||||
) :: any
|
||||
|
||||
return iterator
|
||||
return iterator :: any
|
||||
end
|
||||
|
||||
-- freezing it incase somebody trys doing something stupid and modifying it
|
||||
-- freezing it incase somebody tries doing something stupid and modifying it
|
||||
-- (unlikely but its easy to add extra safety so)
|
||||
table.freeze(World)
|
||||
|
||||
|
|
Loading…
Reference in a new issue