mirror of
https://github.com/Ukendio/jecs.git
synced 2025-07-19 20:49:17 +00:00
Add typings for bulk operations (#257)
* Add typings for bulk operations * Use Id
This commit is contained in:
parent
c3853023d0
commit
c30328527a
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 Id[]>(world: World, entity: Entity, ids: C, values: InferComponents<C>): void
|
||||||
|
export function bulk_remove(world: World, entity: Entity, ids: Id[]): void
|
|
@ -2027,7 +2027,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
|
||||||
|
@ -2105,7 +2105,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
|
||||||
|
@ -2117,7 +2117,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