title: Return array from function
body: <p>--Solved by Elliot B. Thanks!
  May also take int account the other modifications.</p>
  
  <p>Here is the result. Thanks, everyone, for the speedy answers! <a href="http://dl.dropbox.com/u/18785762/Rust/index.html">http://dl.dropbox.com/u/18785762/Rust/index.html</a></p>
  
  <p>I'm writing a game in javascript, and I want to keep the files for matching block IDs to files in a seperate .js file from the map compiler, so that I can edit things easily. However, the IDs are stored in an array, and I can't seem to get it to use the return function properly. Any help?</p>
  
  <p>drawmap.js:</p>
  
  <pre><code>function drawmap() {
  
      var images = BlockID();
  
      var level = [
      "ssssssssssssssssssssss",
      "sgggggggggCCCCCdddddss",
      "ssssssssss     sssssss"
      ];
  
      var top = 100;
      var left = 100;
      var mytop = top;
      var myleft = left;
      for (y=0; y&lt;level.length; ++y) {
          var row = level[y];
          for (x=0; x &lt; row.length; ++x) {
              var c = row.charAt(x);
              if(c != ' ') {
                  img_create(images[c], mytop, myleft);
              }
              mytop += 13;
              myleft += 27;
          }
          mytop = top + (y+1)*13;
          myleft = left - (y+1)*27;
      }
  }
  </code></pre>
  
  <p>mapread.js:</p>
  
  <pre><code>function BlockID() {
      var IDs = new Array();
          images['s'] = "Images/Block_01.png";
          images['g'] = "Images/Block_02.png";
          images['C'] = "Images/Block_03.png";
          images['d'] = "Images/Block_04.png";
      return IDs;
  }
  </code></pre>