Jump to content

Help on _ArraySort()


root
 Share

Recommended Posts

When I try to Sort my 2-Dimension Array im getting this error, and dunno why...

im not expierenced with the Array UDF so maybe someone may help with this.

AutoIt Version : 3.2.2.0

Thats The Error Msg when Running the Script:

\\Path\Array.au3 (582) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

Local $pivot = $array[int(($left + $right)/2)]

Local $pivot = ^ ERROR

Global $ListArray[255][2]

Func createList()
    Local $in, $Temp
    GUICtrlDelete($List1)
    $List1     = GuiCtrlCreateListView("1              ", 20, 30, 170, 200)
    $in = FileOpen(@ScriptDir & "\test.txt", 0)
    While 1
        $Line = FileReadLine($in)
        If @error = -1 Then ExitLoop
        $Temp       = StringSplit($Line, @TAB)
        $ListArray[$i][0] = $Temp[1]
        $ListArray[$i][1] = $Temp[2]
        $i += 1
    WEnd
    $Size = $i
        _ArraySort($ListArray, 0, 0, $i)
    For $i = 0 To $Size Step 1
        GUICtrlCreateListViewItem($ListArray[$i][0], $List1)
    Next
    FileClose($in)
EndFunc
Link to comment
Share on other sites

I am having this exact same problem right now. My 2d array is always [99][2] and I get the same error message when I try to run _ArraySort($aArray). I checked the array's contents and they look fine, so I don't know why this is happening.

Link to comment
Share on other sites

  • Developers

I am having this exact same problem right now. My 2d array is always [99][2] and I get the same error message when I try to run _ArraySort($aArray). I checked the array's contents and they look fine, so I don't know why this is happening.

You need to specify the number of dimensions.

_ArraySort( $avArray,0,0,0,2)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...