From 91f151ee3ffb8c4083079d4f02f82bed49501fa1 Mon Sep 17 00:00:00 2001 From: Ukendio Date: Tue, 24 Sep 2024 01:11:24 +0200 Subject: [PATCH] check for most occuring case --- src/init.luau | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/init.luau b/src/init.luau index b8154ec..ef53352 100644 --- a/src/init.luau +++ b/src/init.luau @@ -389,8 +389,10 @@ local function world_has(world: World, entity: number, ...: i53): boolean return true end -local function world_target(world: World, entity: i53, relation: i24, index_opt: number?): i24? - local index = if index_opt then index_opt else 0 +local function world_target(world: World, entity: i53, relation: i24, index): i24? + if index == nil then + index = 0 + end local record = world.entityIndex.sparse[entity] local archetype = record.archetype if not archetype then @@ -1813,7 +1815,7 @@ export type World = { component: (self: World) -> Entity, --- Gets the target of an relationship. For example, when a user calls --- `world:target(id, ChildOf(parent), 0)`, you will obtain the parent entity. - target: (self: World, id: Entity, relation: Entity, nth: number?) -> Entity?, + target: (self: World, id: Entity, relation: Entity, nth: number) -> Entity?, --- Deletes an entity and all it's related components and relationships. delete: (self: World, id: Entity) -> (),