title: Creating a multidimensional array in AutoHotKey that is updated according to user inputs
body: <h3>General problem</h3>
  <p>In AutoHotKey, I'm having a hard time appending values to an <code>Array</code> object that starts off empty and then gets filled up with values as the user performs certain actions.</p>
  <h3>The script</h3>
  <p>Copied below is a small reproducible version of my script. In it, the goal is for the <code>NumpadAdd</code> key to add the current mouse position to the <code>Array</code> called <code>list_of_mouse_positions</code>. After adding a few points, the user can use the <code>Numpad0</code> key to look at the list of positions stored thus far.</p>
  <pre><code>;---------------;
  ; GENERAL SETUP ;
  ;---------------;
  
  coordmode Mouse, screen
  
  ; Creates an empty array. This will store the mouse positions.
  list_of_mouse_positions := Array()
  
  ;-----------;
  ; FUNCTIONS ;
  ;-----------;
  
  ; Function used to add the current mouse position to the global
  ; list of mouse positions. The `x` parameter serves no purpose.
  AddLocation(x)
  {
      MouseGetPos, xpos, ypos
      mouse_pos := Array()
      mouse_pos[1] := xpos
      mouse_pos[2] := ypos
      list_of_mouse_positions.Push(mouse_pos)
  }
  
  ;-------------;
  ; KEYBINDINGS ;
  ;-------------;
  
  ; Adds the current mouse position to the 
  NumpadAdd::
      AddLocation(0)
      return
  
  ; Checking the mouse positions stored so far
  NumPad0::
      MsgBox, %list_of_mouse_positions%
      return
  
  </code></pre>
  <h3>Expected Output vs Actual Output</h3>
  <p>After running the script and hitting the <code>NumpadAdd</code> key to capture a couple of coordinates, I hit the <code>Numpad0</code> key. What I expected to show up was a Message Box containing all of the coordinates. However, what showed up instead was just an empty message box.</p>
  <h3>Specific question</h3>
  <p>How can I update an <code>Array</code> object (in my case, the <code>list_of_mouse_positions</code> variable) by appending new rows to it, each one of which stores two new values?</p>
  <h3>Note about the expected dimensions of <code>list_of_mouse_positions</code></h3>
  <p>I expect the <code>list_of_mouse_positions</code> variable to be a multidimensional array of dimensions <code>(n x 2)</code>, where the first column contains all of the x values, and the second column contains all of the y values.</p>
  <p>For example, suppose the user &quot;captured&quot; the coordinates of the following mouse positions:</p>
  <ul>
  <li>(100, 200)</li>
  <li>(400, 100)</li>
  <li>(600, 150)</li>
  </ul>
  <p>In this case, the structure of the <code>list_of_mouse_positions</code> would be as follows:</p>
  <pre><code>list_of_mouse_positions[1,1] = 100
  list_of_mouse_positions[1,2] = 200
  list_of_mouse_positions[2,1] = 400
  list_of_mouse_positions[2,2] = 100
  list_of_mouse_positions[3,1] = 600
  list_of_mouse_positions[3,2] = 150
  </code></pre>