No announcement yet.

How to kill an immortal array item?

  • Filter
  • Time
  • Show
Clear All
new posts

    How to kill an immortal array item?

    I have an array of (spawned) actors and I would really really like to remove the actor from the game (actor -> destroy) AND also from the array.

    Sounds easy, If there wasn't the garbage collection maybe...

    So, looping through the array -> cast to actor -> destroy actor works fine.

    Looping afterwards again through the same indexes -> array: remove index.....well, works fine...for the first 5-9 out of 15 items than the message log shows the following warning: "LogArray:Warning: Attempted to remove an item from an invalid index from array myArray [10/15]!"

    Who cares? I do, because the index isn't really "invalid" - it still exists and a later array -> add will result in a new array length of 16


    Last edited by Wolfsblut; 08-21-2014, 02:46 PM.

    Solved...well kind of.

    There is no such thing as a "remove". It will clean the value of array[i], but not the item itself.

    I'm happy, cause I only (for today) have to remove the last x items from an array. In doing so resizing the array works.

    [Request] Array->delete(i) would be more than nice, wouldn't it?