• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - Code Still only 2D arrays ?

Xer0botXer0

Senpai
Hi guys, I haven't gotten around to using my beta key, I'd like to find out if gms 2.0 still only has 2D arrays ?
 
A

Aura

Guest
Yes, but now we have array literals.

Code:
var a = [1, 2, 3, 4, 5];
var b = [];
...and nested arrays.

Code:
var c = [1, 2, [3, [4, 5]], 6];
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
You could place arrays in other arrays for as long arrays became by-reference. In 1.x it was
Code:
var arr2; arr2[1] = 1;
var arr1; arr1[2] = arr2; // arr1 = [ 0, 0, [0, 1] ]
Once accessor chaining will be supported, all should be well.
 

Xer0botXer0

Senpai
So thats basically a three dimensional array where the third dimension is a nested two dimensional array ? I think ive done that in gms 1
 

hdarren

Member
My problem is it is messy code.

Code:
global.var_RoomInformation[global.var_RoomInformation_SubArray[0,0],0];
Compared to clean code.

Code:
global.var_RoomInformation[0,0,0]
 
  • Like
Reactions: Ubu
Top