Page MenuHomeFeedback Tracker

Provide 'ARRAY erase ARRAY' method for removing array elements
Closed, ResolvedPublic

Description

EDIT: look here: http://feedback.arma3.com/view.php?id=14944#c57829

At the moment resize works only from the beginning of an array

a = [1,2,3,4,5];
a resize 3;

results in [1,2,3]

With proposed negative offset, array should be reverse resized:

a = [1,2,3,4,5]
a resize -3;

will result in [3,4,5]

This little addition hopefully will patch some of the inadequacies with SQF language.

Details

Legacy ID
1617939121
Severity
None
Resolution
Fixed
Reproducibility
Always
Category
Feature Request
Steps To Reproduce

N/A

Additional Information

Also when you exceed the array size it should behave as normal only in reverse

a = [1,2,3,4,5]
a resize -6

result [<null>,1,2,3,4,5]

Event Timeline

Killzone_Kid edited Additional Information. (Show Details)
Killzone_Kid set Category to Feature Request.
Killzone_Kid set Reproducibility to Always.
Killzone_Kid set Severity to None.
Killzone_Kid set Resolution to Fixed.
Killzone_Kid set Legacy ID to 1617939121.May 7 2016, 4:55 PM

I've outlined many benefits that this improvement can bring with examples in this blog post http://killzonekid.com/arma-scripting-tutorials-array-resize/

Please upvote if you care.

would be very useful

a good c++ implementation should be easy to grab somewhere

Thank you .kju for support. I have looked up c++ reference and realised that trying to ask for little is actually more work for the programmers. It looks like current "resize" command is the wrapper for c++ "vector:resize" http://www.cplusplus.com/reference/vector/vector/resize/

Because of this I think it would be reasonable to request a new command instead, - "erase" as a wrapper for c++ "vector:erase" http://www.cplusplus.com/reference/vector/vector/erase/. I think this will deliver even more flexibility while retaining the asked functionality. You will be able just to remove portion of array from the beginning yourself, as if it was reverse resized.

Actually "reverse" command would do to. but cannot see it being a vector method. tbh I am not sure what arrays are internally vectors? lists? Lists have reverse method.

Anyway, would really really like to see this added, manipulating arrays is awkward atm. Would also be nice have an option for callExtension return array data type too ;)

Erase 1 element:

_array erase 10; //erase (_array select 10) element of _array

Erase range:

_array erase [0,3]; //erase elements 0, 1, 2 and 3

will also improve removing elements by

_array set [5, "deleteme"]
_array = _array - ["deleteme"];

awkwardness

Nou added a subscriber: Nou.May 7 2016, 4:55 PM
Nou added a comment.Sep 2 2014, 9:27 PM

Internally the arrays are a custom type.

They _probably_ already have a method for doing this on them internally. _Probably_.

:)

Mass-closing all resolved issues not updated in the last month.

Please PM me in BI Forums (http://forums.bistudio.com/member.php?55374-Fireball) if you feel your bug was closed in error.