#2824 closed Bug (Fixed)
_ArrayExtract bugged + solution
| Reported by: | Quirinus | Owned by: | |
|---|---|---|---|
| Milestone: | Component: | Standard UDFs | |
| Version: | 3.3.12.0 | Severity: | None |
| Keywords: | UDF, Array, _ArrayExtract, Bug, Solution | Cc: |
Description
The problem is the same as here, but with _ArrayExtract instead:
http://www.autoitscript.com/forum/topic/163244-arraytostring-bugged/
$height = 10
$width = 6
Local $aArray[$width][$height]
For $i = 0 To $width-1
For $j = 0 To $height-1
$aArray[$i][$j] = "(" & $i & "," & $j & ")"
Next
Next
_ArrayDisplay($aArray, "Original")
$column = 0
_ArrayDisplay(_ArrayExtract($aArray, 0, $width-1, $column, $column), "Extracted")
Seems like Melba23 found the solution in that thread. He didn't post it, but I think it's just removing this line:
If $iEnd_Col = 0 Then $iEnd_Col = $iDim_2
from Array.au3 UDF file in the _ArrayExtract function under Case 2 (for me that's the line 951). I'm not sure if this messes up something else, though, so it should be tested and carefully thought about.
Also, the documentation is wrong. The whole Return Values and Remarks section for this function are suspect (someone probably copy-pasted from another function then forgot to change). The return value on success is actually the extracted array, not 1.
Thank you.
Attachments (0)
Change History (6)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
Ok, I noticed it doesn't work for rows as well, so in addition to removing the line above, you need to remove this line as well:
If $iEnd_Row = 0 Then $iEnd_Row = $iDim_1
comment:3 by , 12 years ago
The same problem might be in other functions in Array.au3, so it might be wise to check them all, preventively.
comment:6 by , 11 years ago
I would like to add that this problem is still not resolved:
The return value on success is actually the extracted array, not 1.
The helpfile still contains "return value = 1" for _ArrayExtract, which is wrong.

Sorry, I forgot to mention what's the problem and solution.
The problem is that _ArrayExtract extracts all columns if you put start and end column number 0, but it should just extract the 0-th column instead. If you use any other start/end column setup, it works (except the ones that produce errors, obviously).