mirror of
https://github.com/Ukendio/jecs.git
synced 2025-08-04 03:09:18 +00:00
Add typings for bulk operations
This commit is contained in:
parent
210d62d463
commit
15cf96ecc3
2 changed files with 6 additions and 3 deletions
3
jecs.d.ts
vendored
3
jecs.d.ts
vendored
|
@ -321,3 +321,6 @@ export type ComponentRecord = {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function component_record(world: World, id: Id): ComponentRecord
|
export function component_record(world: World, id: Id): ComponentRecord
|
||||||
|
|
||||||
|
export function bulk_insert<const C extends Entity[]>(world: World, entity: Entity, ids: C, values: InferComponents<C>): void
|
||||||
|
export function bulk_remove(world: World, entity: Entity, ids: Entity[]): void
|
|
@ -2033,7 +2033,7 @@ local function world_children<a>(world: World, parent: Id<a>)
|
||||||
return world_each(world, ECS_PAIR(EcsChildOf, parent::number))
|
return world_each(world, ECS_PAIR(EcsChildOf, parent::number))
|
||||||
end
|
end
|
||||||
|
|
||||||
local function ecs_bulk_insert(world: World, entity: Entity, ids: { Entity }, values: { any })
|
local function ecs_bulk_insert(world: World, entity: Entity, ids: { Id }, values: { any })
|
||||||
local entity_index = world.entity_index
|
local entity_index = world.entity_index
|
||||||
local r = entity_index_try_get(entity_index, entity)
|
local r = entity_index_try_get(entity_index, entity)
|
||||||
if not r then
|
if not r then
|
||||||
|
@ -2111,7 +2111,7 @@ local function ecs_bulk_insert(world: World, entity: Entity, ids: { Entity }, va
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function ecs_bulk_remove(world: World, entity: Entity, ids: { Entity })
|
local function ecs_bulk_remove(world: World, entity: Entity, ids: { Id })
|
||||||
local entity_index = world.entity_index
|
local entity_index = world.entity_index
|
||||||
local r = entity_index_try_get(entity_index, entity)
|
local r = entity_index_try_get(entity_index, entity)
|
||||||
if not r then
|
if not r then
|
||||||
|
@ -2123,7 +2123,7 @@ local function ecs_bulk_remove(world: World, entity: Entity, ids: { Entity })
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local remove: { [Entity]: boolean } = {}
|
local remove: { [Id]: boolean } = {}
|
||||||
|
|
||||||
local columns_map = from.columns_map
|
local columns_map = from.columns_map
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue