# Saving a Game Map To a Single String, An Array of Arrays Problem

**URL:** <https://forum.kirupa.com/t/saving-a-game-map-to-a-single-string-an-array-of-arrays-problem/327329>\
**Category:** flash\
**Created:** [February 22, 2012, 7:18am UTC](https://forum.kirupa.com/t/saving-a-game-map-to-a-single-string-an-array-of-arrays-problem/327329 "2012-02-22T07:18:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![noisavni](https://avatars.discourse-cdn.com/v4/letter/n/b487fb/32.png) [@noisavni](https://forum.kirupa.com/u/noisavni)\
**Post date:** [February 22, 2012, 7:18am UTC](https://forum.kirupa.com/t/saving-a-game-map-to-a-single-string-an-array-of-arrays-problem/327329/1 "2012-02-22T07:18:41Z")

</div>

\*\*What I’m trying to do: \*\*I’m attempting to make a flat text file made up of game map information. I have an array of objects that I’m extracting the properties from and converting to a multidimensional array (an array of arrays). then finally imploding or joining into a single string separated by 2 glue strings.

\*\*In short the problem: \*\*The problem is that the code works but in an unexpected way.

**The Code:**

```auto

var mapTextArr:Array = [[],[],[]];
for(var i=0; i<mapObjectsArr.length; i++){
  for(var j=0; j<9; j++){
    if(mapObjectsArr*.returnProperty(j) != null){
      mapTextArr*[j] = mapObjectsArr*.returnProperty(j);                  
    }
  }
}
trace(joinArrays(mapTextArr, "::", "]["));

```

\*\*The problem with the above code: \*\*The above code works but only for 3 objects or less. In order to add a forth I would need to change mapTextArray var to equal [[],[],[],[]] which I’m unsure how to do pragmatically and it seems there should be an entirely easier solution.

**here’s the output for reference:**  
[object MapProperties],[object DirtObject]  
1::1][2::400::300::40::20::0  
[object MapProperties],[object DirtObject],[object DirtObject]  
1::1][2::400::300::40::20::0][2::400::300::40::20::0  
[object MapProperties],[object DirtObject],[object DirtObject],[object DirtObject]  
TypeError: Error #1010: A term is undefined and has no properties.  
at MapEditor/butCheck()

:stare:
