Modify

#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)

in reply to:  description comment:1 by Quirinus, on Aug 5, 2014 at 3:40:44 AM

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).

comment:2 by Quirinus, on Aug 5, 2014 at 3:55:19 AM

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 Quirinus, on Aug 5, 2014 at 3:57:56 AM

The same problem might be in other functions in Array.au3, so it might be wise to check them all, preventively.

comment:4 by Melba23, on Aug 9, 2014 at 3:55:55 PM

I have posted a solution in your forum thread - please check it.

M23

comment:5 by Melba23, on Aug 19, 2014 at 10:29:12 AM

Resolution: Fixed
Status: newclosed

Fixed.

M23

comment:6 by anonymous, on Sep 12, 2015 at 2:25:01 AM

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.

Modify Ticket

Action
as closed The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.