initializing 2d arrays

Get help with using AutoHotkey and its commands and hotkeys
Posts: 61
Joined: 03 Mar 2020, 20:06

initializing 2d arrays

25 Apr 2020, 02:34

I know how to initialize them like

Code: Select all

 2darray := [[]]  
but that only allows me to add 1 element inside the array. When starting my script, I do not know if I will need to initialize it like this [[], [], []] to have three elements contained in the array, or if i will need 5 elements contained in the array until later on. How would I go about correctly initializing the 2d array? For example,

Code: Select all

if (numberOfArraysIWillNeed = 5)
      array := [[], [], [], [], []]
except the number of arrays I would need could be anywhere from 1 to 500.
Posts: 4479
Joined: 17 Jul 2016, 01:02

Re: initializing 2d arrays

25 Apr 2020, 04:33

See :arrow: arrays of arrays, example

Code: Select all

2darray := []
; ...
2darray[x, y] := z 

Return to “Ask For Help”

Who is online

Users browsing this forum: AHKStudent, fiendhunter, superpeter, thebbandit and 36 guests