Tag: arrays

Latest GameMaker Studio update improves GML arrays implementation

I’m quite happy about this. I’d like even more improvements to the array and string functions to come in time, but this is long overdue. Arrays in GameMaker have been clunky but serviceable forever, and this just made them a good bit easier and more useful.

From the GM:Studio 1.1.1008 release notes:

  • Arrays can now be passed/returned from scripts.
    • NOT pass by reference
    • If array values are set, then the array is copied
  • Arrays are now native on HTML5, making them significantly quicker.
  • Arrays can now be freed!
    • To free an array, simply set the variable to 0 (if MyVar was an array, MyVar=0 would free it)
  • 3 new array functions added
    • is_array()
    • array_length_1d() gives the size of the 1st dimension
    • array_length_2d() gives the size of the 2nd dimension. Arrays are ragged, not grids. so the each element of the 2nd dimension varys in size