﻿id	summary	reporter	owner	description	type	status	milestone	component	version	severity	resolution	keywords	cc
2150	_FileWriteFromArray() 2d array bug	i2c		"{{{
Dim $aArray[2][2] = [[1, 2],[3, 4]]
_FileWriteFromArray(@ScriptDir & ""\aArray.txt"", $aArray, 0, 0, ""|"")
}}}
{{{
C:\Program Files (x86)\AutoIt3\Include\File.au3 (272) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:
$s_Temp &= $s_Delim & $a_Array[$x][$y]
$s_Temp &= $s_Delim & ^ ERROR
}}}

Line 271 to 274 of File.au3:
{{{
For $y = 1 To $iDims
					$s_Temp &= $s_Delim & $a_Array[$x][$y]
				Next
}}}
In case we want to write a 2d array to a file, we already know, that we have 2 dimensions at this point cause the dimension count is saved in $iDims. It's not necessary to run this for loop cause $y can '''only''' be 1 furthermore $iDims is 2 so we will run into an error.

Solution:
{{{
For $y = 1 To $iDims - 1
					$s_Temp &= $s_Delim & $a_Array[$x][$y]
				Next
}}}
or better remove the loop and do the following
{{{
 For $x = $i_Base To $i_UBound
                $s_Temp = $a_Array[$x][0] & $s_Delim & $a_Array[$x][1]
                If FileWrite($hFile, $s_Temp & @CRLF) = 0 Then
}}}

"	Bug	closed		Standard UDFs	3.3.8.0	None	Duplicate	_FileWriteFromArray	
