Sorry for the noob question, but I can’t wrap my head around the way Verse works, I can’t even do the simplest things.
I want to remove an item from an array of item spawners at index 0. I tried this: set ItemSpawners = array{ItemSpawners[1]..ItemSpawners[Length-1]}
I also tried it with a temporary array, copying values one by one in a for loop.
I couldn’t get it working. As far as I know there’s no remove or delete functions.
You can remove an item from an array using (InputArray:[]t).RemoveElementAt(IndexToRemove:int):[]t. This returns a new copy of the array with the element removed.
Here is an example usage:
var MyDeviceArray:[]creative_device = array{}
if (NewArray := MyDeviceArray.RemoveElement[0]):
set MyDeviceArray = NewArray
The functions are implemented as extension methods on []t which I’ve found aren’t discoverable as part of our API documentation. I’ve flagged this to the documentation team so we can make improvements here in the future.