# How to add an element to an array that contains another array

**URL:** <https://forums.unrealengine.com/t/how-to-add-an-element-to-an-array-that-contains-another-array/1921847>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [June 30, 2024, 5:37pm UTC](https://forums.unrealengine.com/t/how-to-add-an-element-to-an-array-that-contains-another-array/1921847 "2024-06-30T17:37:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Soy\_Ema\_31](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Soy\_Ema\_31](https://forums.unrealengine.com/u/Soy_Ema_31)\
**Post date:** [June 30, 2024, 5:37pm UTC](https://forums.unrealengine.com/t/how-to-add-an-element-to-an-array-that-contains-another-array/1921847/1 "2024-06-30T17:37:04Z")

</div>

I know how to add elements to an array, but I don’t know how to add elements to the following array structure

```auto
PropData:=class<concrete>():
    @editable
    PropsIn:[]creative_prop = array{}

Forum := class(creative_device):
    
    @editable
    IndexProp:[]PropData = array{}

```

In a creative\_prop array they are added in the following way

```auto
var PProps:[]creative_prop=array{}

HamburguerList:=GetCreativeObjectsWithTag(HamburguerTag{})
            for(Hamburguer:HamburguerList):
                if(H:=creative_prop[Hamburguer]):
                    set PProps += array{H}

```

---

<div class="post-metadata">

**Author:** ![Mineblo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mineblo/32/1203575_2.png) [@Mineblo](https://forums.unrealengine.com/u/Mineblo)\
**Post date:** [June 30, 2024, 5:40pm UTC](https://forums.unrealengine.com/t/how-to-add-an-element-to-an-array-that-contains-another-array/1921847/2 "2024-06-30T17:40:59Z")

</div>

Im confused where do you want the elements to be? From what I assume you already are putting the creative\_props in the PropsIn array and the IndexProp Will just have the different prop arrays could you be more specific as to what youre trying to achieve?

---

<div class="post-metadata">

**Author:** ![Soy\_Ema\_31](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Soy\_Ema\_31](https://forums.unrealengine.com/u/Soy_Ema_31)\
**Post date:** [June 30, 2024, 5:58pm UTC](https://forums.unrealengine.com/t/how-to-add-an-element-to-an-array-that-contains-another-array/1921847/3 "2024-06-30T17:58:43Z")

</div>

Basically what I want to do is that in position 0 I assign elements from a creative\_prop, in position 1 I assign elements from another creative\_prop and so on.  
In a way similar to this  
 ![1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/7/6/6761f389283565505689c11e68dbf27245df5dd5.jpeg)  
In the editor it can be done manually but I want to do it in code

---

<div class="post-metadata">

**Author:** ![Soy\_Ema\_31](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Soy\_Ema\_31](https://forums.unrealengine.com/u/Soy_Ema_31)\
**Post date:** [June 30, 2024, 6:17pm UTC](https://forums.unrealengine.com/t/how-to-add-an-element-to-an-array-that-contains-another-array/1921847/4 "2024-06-30T18:17:17Z")

</div>

Here is what I have

```auto
PropData:=class<concrete>():
    @editable
    PropsIn:[]creative_prop = array{}

Forum := class(creative_device):
    
    @editable
    IndexProp:[]PropData = array{}

```

To make myself clear, I want to add elements to the IndexProp array but I do not know how to do it. I try to do the following but it does not work

```auto
for(Hamburguer:HamburguerList):
  if(H:=creative_prop[Hamburguer]):
    set IndexProp.PropsIn += array{H}

```

---

<div class="post-metadata">

**Author:** ![Soy\_Ema\_31](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Soy\_Ema\_31](https://forums.unrealengine.com/u/Soy_Ema_31)\
**Post date:** [June 30, 2024, 7:47pm UTC](https://forums.unrealengine.com/t/how-to-add-an-element-to-an-array-that-contains-another-array/1921847/5 "2024-06-30T19:47:21Z")

</div>

I already know how to solve it

```auto
if(H:=creative_prop[Hamburguer]):
  SaveProp:=PropData{PropsIn:= array{H}}
  set IndexProp += array{SaveProp}

```

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [July 30, 2024, 7:48pm UTC](https://forums.unrealengine.com/t/how-to-add-an-element-to-an-array-that-contains-another-array/1921847/6 "2024-07-30T19:48:19Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
