Scripting/GML-Overview/Arrays/array_create

Last-modified: 2018-12-21 (金) 19:00:52

array_create

 

Description
With this function you can create an array of a given size. You tell the function the length of the array to create, and it will return the "handle" for the array which you can then assign to a variable. Arrays created in this way will have each entry initialised to 0 unless you specify an (optional) initialisation value. If you do supply the extra value for initialising the array, then all indices within the new array will be set to that instead of 0, but note that the function will take longer to run.

 

Syntax:

array_create(size, [value]);
 

Arguments:

ArgumentDescription
sizeThe size of the array to create.
valueThe value to use to initialise all array indices (optional).
 

Returns:

Array (handle)
 

Example:

instance_array = array_create(100, noone);
 

The above code will create a new array of 100 entries, each one set to the keyword noone, and then assign it to the variable "instance_array".