Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 22nd, 2024, 6:11 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Multidimensional Arrays
PostPosted: April 15th, 2008, 1:13 pm 
Offline

Joined: April 11th, 2005, 2:31 pm
Posts: 122
Location: Edinburgh
I would like to see multidimensional arrays. This is possible in Javascript 3.0 but does not seem to be implemented in Opus.

Also the Javascript Switch(n) command to do the same job as select case

_________________
Windows 7 Ultimate (32 bit)
Opus Pro 6.4, Opus 7
Dual Core Athlon 64 4000+
4 gb Ram


For this message David has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: April 15th, 2008, 11:05 pm 
Offline

Joined: November 11th, 2004, 4:05 am
Posts: 636
Location: Christchurch, NZ
Like you, I find the lack of a switch statement inconvenient at times.
Multidimensional arrays can be achieved using something like this:

//>>>> script >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

myArray = new Array(2);
myArray[0] = new Array(2);
myArray[1] = new Array(2);

myArray["OO"] = new Array();

myArray[0][0] = "anna";
myArray[0][1] = "paul";
myArray[1][0] = "dave";
myArray[1][1] = "michael";

myArray["OO"]["PP"] = "anyone";

Debug.trace( myArray[0][0] + "\n" );
Debug.trace( myArray[0][1] + "\n" );
Debug.trace( myArray[1][0] + "\n" );
Debug.trace( myArray[1][1] + "\n");
Debug.trace( myArray["OO"]["PP"] + "\n");

//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Paul


For this message Paul has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: April 16th, 2008, 7:34 am 
Offline

Joined: April 11th, 2005, 2:31 pm
Posts: 122
Location: Edinburgh
Thanks for the reply Paul.

I was trying something similar to define 3x3 array:

//
my_Array= new Array (3);
for (loop = 0; loop < 3; ++ loop)
myArray[loop] = new Array (3);

my_Array[0][0] = "Column 1, Row 1";
my_Array[0][1] = "Column 1, Row 2";

//etc..........

Which produces an error- but your solution is perfect!

Yes, the lack of a Switch command means that you often have a huge list of nested ifs - not the easiest to debug.

Cheers.

David

_________________
Windows 7 Ultimate (32 bit)
Opus Pro 6.4, Opus 7
Dual Core Athlon 64 4000+
4 gb Ram


For this message David has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: April 28th, 2009, 4:48 pm 
Offline

Joined: May 24th, 2007, 11:02 am
Posts: 132
Location: UK - Wales - Ceredigion
Opus: illuminatus > Evolution
OS: Windows 10 Pro
System: i7 8GB RAM
I too would also like these two basic functions :?


For this message jezjones29 has been thanked by : mackavi


Top
 Profile Visit website  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 37 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group