Announcement

Collapse
No announcement yet.

Find in Struct Array ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    Try utilise the array index to store as a named ref.

    Alternatively if there's too much looping/iteration and you really want to use a variable in your struct as a key to find(); you can create a dictionary.
    Initialise the new Dictionary variable first with key : struct
    where key = Name
    and struct = YourStructure

    I would create a function mapArrayOfStructToDictionary(struct, StructVarAsKey).
    You need to ensure every value is unique else the dictionary item will be removed. Now decide if a data table is better where you enforce unique keys
    Attached Files

    Leave a comment:


  • replied
    Then you have lots of stuff to iterate through ^^

    Struct holds many variables, but isnĀ“t an array by itself.

    Leave a comment:


  • replied
    What if there's lots of items ?

    Leave a comment:


  • replied
    you have to iterate over each item.

    Leave a comment:


  • started a topic Find in Struct Array ?

    Find in Struct Array ?

    I need to create an array with each item having multiple properties e.g. actor + float, so I started to use a Struct which works fine. However as the float may differ each time I can't just use array find because of the change. I don't really want to create a second array with maybe a name or something to ID it and then get the index, also without looping through each item just to find a specific one that has a matching variable.

    Any suggestions ?
Working...
X