# Dynamically Creating a 3 Dimensional Array?

**URL:** <https://forum.kirupa.com/t/dynamically-creating-a-3-dimensional-array/123442>\
**Category:** Uncategorized\
**Created:** [September 23, 2004, 5:47pm UTC](https://forum.kirupa.com/t/dynamically-creating-a-3-dimensional-array/123442 "2004-09-23T17:47:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![smallgreY](https://avatars.discourse-cdn.com/v4/letter/s/94ad74/32.png) [@smallgreY](https://forum.kirupa.com/u/smallgreY)\
**Post date:** [September 23, 2004, 5:47pm UTC](https://forum.kirupa.com/t/dynamically-creating-a-3-dimensional-array/123442/1 "2004-09-23T17:47:46Z")

</div>

:puzzled: This seemingly trivial problem is _really_ confounding me. I have a 3 dimensional array like this …

```auto

[font=Courier New]oldmap = [[['a1',0],['a1',1]], [/font]
[font=Courier New] [['a0',1],['a1',0]]];[/font]

```

I simply want to take this array, modify the data, and create a new array. Here’s the code (minus the transform functions):

```auto

 
[font=Courier New]newmap = new Array();[/font]
 
[font=Courier New]for (i=0;i<map_height;i++) { [/font]
[font=Courier New]for (j=0;j<map_width;j++) {[/font]
 
[font=Courier New]	old_label = oldmap*[j][0];[/font]
[font=Courier New]	old_type = oldmap*[j][1];[/font]
 
[font=Courier New]	// transform the data[/font]
[font=Courier New]	new_label = transformLabel(old_label);[/font]
[font=Courier New]	new_type = transformType(old_type);[/font]
 
[font=Courier New]	state = [new_label,new_type];[/font]
 
[font=Courier New]	// THIS LINE IS NOT WORKING[/font]
[font=Courier New]	newmap*[j].push(state);[/font]
 
[font=Courier New]} // end j [/font]
[font=Courier New]} // end i[/font]
 
[font=Courier New]trace(newmap);[/font]
 

```

When I trace “newmap” I always get undefined.

Thanks in advance … been reading the forum for a week now … great info … good to meet you! 🙂
