Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
sui
Newbie


Joined: 07 Feb 2003
Posts: 8

PostPosted: Fri Feb 21, 2003 8:14 pm   

experts, please help !
 
I tried to create a multidimensional array in Zscript without much success. I also tried to use JScript, and it worked but couldn't export the array in a variable that i can use from Zscript, nor i could make the array static. This array is supposed to be a 3d array 100*100*100, so is quite big, i can create it "on the fly" every time i use it. Anybody has any ideea at all, i would be much gratefull.

Player of Sui
Reply with quote
Charbal
GURU


Joined: 15 Jun 2001
Posts: 654
Location: USA

PostPosted: Fri Feb 21, 2003 8:50 pm   
 
If you post why you need to use such a large multidimensial array, we may be able to suggest alternate implementations that will be more efficient. You probably don't have meaningful data in each of these one million entries so a different data structure may be beneficial.

Still, if you need a 100x100x100 array, you can use an array of 1000000 elements, indexed from 0 to 999999.

Then to access (x,y,z) in the multidimensional array (x, y and z all between 0 and 99), just use element 10000*x+100*y+z in the singly dimensioned array. This is how staticly allocated multidimensional arrays are handled in other programming languages. It's just done behind the scenes there.


 - Charbal
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net