initializing 2d arrays

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
awcrt9316
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.
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: initializing 2d arrays

25 Apr 2020, 04:33

See :arrow: arrays of arrays, example

Code: Select all

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

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot] and 216 guests