Legacy GM array_create problem [SOLVEDish]

Fixer90

Member
The syntax in the documentation for array_create is array_create(size, [value]);

The [value] part lets me set a default value for every variable in the array. However, despite the documentation clearly saying I can do this, I get an error when I try to put something in the value slot. I even copied over the documentation's example perfectly (instance_array = array_create(100, noone);) - still an error.

I don't know if this was changed in an update or what; but I'd like to know if there's at least a way around this.
 

Fixer90

Member
Is there a way to code around this? A way to set a value for each in 1.4 using a different method?
 

DukeSoft

Member
Best way in GMS2 is literal array notations :)

Code:
var array = [noone, 1, 3, 4];
If you need to fill it up, its best to first define the size, and then fill it up:
Code:
var fill = noone;
var size = 100;
array[size] = noone;
for (var i = 0; i < size-1; i++) {
    array[i] = fill;
}
EDIT: Weird though how the documentation is wrong (allthough I'm not surprised anymore)
 
Top