GE can't randomize 2D array

Non-platform specific questions.

GE can't randomize 2D array

Postby Bee-Ant » Fri Nov 26, 2010 9:46 am

This for GE's developers..

Make some arrays in Global code first...for example:
Code: Select all
int Array2D[6][5]=
{
    0,1,2,3,4,
    5,6,7,8,9,
    10,11,12,13,14,
    15,16,17,18,19,
    20,21,22,23,24,
};

int Array1D[6]=
{
    0,1,2,3,4,
};


Then type this in any Script Editor:
Code: Select all
int i=Array2D[rand(5)][rand(5)];
int j=Array1D[rand(5)];


Why the first line give an error while the second line not?
Why we can't randomize array 2D index DIRECTLY, while we can in 1D array?
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: GE can't randomize 2D array

Postby lcl » Fri Nov 26, 2010 10:27 am

Oh, I first thought you had written something wrong by accident but you're right, it doesn't work. :P
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest