Skip to content

Commit

Permalink
check for most occuring case
Browse files Browse the repository at this point in the history
  • Loading branch information
Ukendio committed Sep 23, 2024
1 parent 16e8055 commit 91f151e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/init.luau
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1813,7 +1815,7 @@ export type World = {
component: <T>(self: World) -> Entity<T>,
--- 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) -> (),

Expand Down

0 comments on commit 91f151e

Please sign in to comment.