resize: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - " <h3 style="display:none">Notes</h3> <dl class="command_description"> <!-- Note Section BEGIN --> <!-- Note Section END --> </dl> " to "")
m (Text replacement - " *\| *([Cc]omments|COMMENTS|Game|[Gg]ame [Nn]ame|Game [Vv]ersion|Game Version \(number surrounded by NO SPACES\)|Multiplayer Arguments( \("local" or "global"\))?|Effects|Multiplayer Effects( \("local" or "global"\))?|Multiplayer Exe...)
Line 3: Line 3:
{{GameCategory|arma1|Scripting Commands}}
{{GameCategory|arma1|Scripting Commands}}


{{Command|Comments=
{{Command


| ofpr |Game name=
| ofpr


|1.75|Game version=
|1.75


|gr1= Arrays |GROUP1=
|gr1= Arrays


| Changes the size of the given array. The command does not return new array, it resizes the source array to the desired number of elements. If the new size is bigger than the current size, the new places are filled with [[nil]]s. |DESCRIPTION=
| Changes the size of the given array. The command does not return new array, it resizes the source array to the desired number of elements. If the new size is bigger than the current size, the new places are filled with [[nil]]s.


| array '''resize''' count |SYNTAX=
| array '''resize''' count


|p1= array: [[Array]] |PARAMETER1=
|p1= array: [[Array]]
|p2= count: [[Number]] - the new number of elements. |PARAMETER2=
|p2= count: [[Number]] - the new number of elements.


| [[Nothing]] |RETURNVALUE=
| [[Nothing]]
   
   
|x1= <code>_arrayNum = [0,1,2,3,4];
|x1= <code>_arrayNum = [0,1,2,3,4];
_arrayNum [[resize]] 2; // _arrayNum is now [0,1]
_arrayNum [[resize]] 2; // _arrayNum is now [0,1]
</code>|EXAMPLE1=
</code>


| [[Array]], [[set]], [[reverse]], [[select]], [[in]], [[find]], [[findIf]], [[toArray]], [[toString]], [[forEach]], [[count]], [[pushBack]], [[pushBackUnique]], [[apply]], [[deleteAt]], [[deleteRange]], [[append]], [[sort]], [[param]], [[params]], [[arrayIntersect]], [[splitString]], [[joinString]]|SEEALSO=
| [[Array]], [[set]], [[reverse]], [[select]], [[in]], [[find]], [[findIf]], [[toArray]], [[toString]], [[forEach]], [[count]], [[pushBack]], [[pushBackUnique]], [[apply]], [[deleteAt]], [[deleteRange]], [[append]], [[sort]], [[param]], [[params]], [[arrayIntersect]], [[splitString]], [[joinString]]


}}
}}

Revision as of 02:19, 18 January 2021


Hover & click on the images for description

Description

Description:
Changes the size of the given array. The command does not return new array, it resizes the source array to the desired number of elements. If the new size is bigger than the current size, the new places are filled with nils.
Groups:
Arrays

Syntax

Syntax:
array resize count
Parameters:
array: Array
count: Number - the new number of elements.
Return Value:
Nothing

Examples

Example 1:
_arrayNum = [0,1,2,3,4]; _arrayNum resize 2; // _arrayNum is now [0,1]

Additional Information

See also:
ArraysetreverseselectinfindfindIftoArraytoStringforEachcountpushBackpushBackUniqueapplydeleteAtdeleteRangeappendsortparamparamsarrayIntersectsplitStringjoinString

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note

Bottom Section

Posted on November 13, 2014 - 06:26 (UTC)
DreadedEntity
Use this number to resize the array to the number of elements desired, not the desired index of the final element.
resize cannot be used to create a new array.