# TArray find a UStruct with UStruct's variable

**URL:** <https://forums.unrealengine.com/t/tarray-find-a-ustruct-with-ustructs-variable/300235>\
**Category:** Editor Scripting\
**Tags:** tarray, ustruct, unreal-engine, find, question\
**Created:** [December 1, 2014, 6:19am UTC](https://forums.unrealengine.com/t/tarray-find-a-ustruct-with-ustructs-variable/300235 "2014-12-01T06:19:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![XAfgun\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@XAfgun\_1](https://forums.unrealengine.com/u/XAfgun_1)\
**Post date:** [December 1, 2014, 6:19am UTC](https://forums.unrealengine.com/t/tarray-find-a-ustruct-with-ustructs-variable/300235/1 "2014-12-01T06:19:48Z")

</div>

UENUM(BlueprintType)  
enum class EquipmentTypes : uint8  
{  
Weapon = 0,  
Weapon2 = 1,  
};

USTRUCT()  
struct FEquipments{  
GENERATED\_USTRUCT\_BODY()

```
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Bonus)
EquipmentTypes EquipmentSlot;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Bonus)
ABaseItem *Item;

FEquipments(){
	
}

```

};

TArray Equipments;

My problem started at this point. I used this but this is a wrong.  
Equipments.FindByKey(EquipmentSlot::Weapon)

How can I find my weapon key struct from Equipments ?

Thanks a lot …

---

<div class="post-metadata">

**Author:** ![UnexpectedSquirt](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@UnexpectedSquirt](https://forums.unrealengine.com/u/UnexpectedSquirt)\
**Post date:** [September 27, 2019, 5:10pm UTC](https://forums.unrealengine.com/t/tarray-find-a-ustruct-with-ustructs-variable/300235/2 "2019-09-27T17:10:47Z")

</div>

FORCEINLINE bool operator==(const EquipmentTypes& Slot) const  
{  
return Slot == EquipmentSlot;  
}

^ add that to your UStruct.
