Tech Blog – Accessors For Data Structures and Arrays

on January 26, 2014 - 5653 Views

YoYo Games, the developers of GameMaker Studio, have posted a new tech blog article explaining how to use a recently added feature, “accessors”, which are designed to make data structures and arrays more flexible and easier to work with. Below is an excerpt.

“Accessors are simple logical expressions that permit you to add or change values within the structure, and they are written in a similar way as you would for working with arrays, only we use a special identifier symbol before the first argument…”

Read the full article »

Recent Posts

2 Responses to Tech Blog – Accessors For Data Structures and Arrays

  1. DaSpirit says:

    I like them, but what is with those symbols? They couldn’t have just made accessing data structures the same as accessing an array? The array accessor itself is neat though, it’s like a reference.

    • Actually, it would not be possible to make data structure access same as array, that’s the thing.
      If you’ve noticed, any reference to data structure is actually just an index (integer).
      There is no method to differentiate between data structure index, resource index, and a number. So it’s not possible to tell, whether by “ds[4] = 1” you meant to change 4-th element of a list, or numeric key 4 of a map.
      Eliminating such syntax would take adding “reference” handling, which is a whole lot of work by itself… and would also break a fair of people’s projects too at first.

Leave a Reply

Your email address will not be published. Required fields are marked *

UA-103187421-1