Jump to content

_ArrayReverse question


Recommended Posts

Here's one that is:

#include <array.au3>

$list = WinList()
_ArrayDisplay($list)
$list = _ArrayReverse_2D($list)
_ArrayDisplay($list)

Func _ArrayReverse_2D($aArray)
    Local $iBound1 = UBound($aArray, 1)
    Local $iBound2 = UBound($aArray, 2)
    Local $aOut[$iBound1][$iBound2]
    
    For $i = 0 To $iBound1 - 1
        For $j = 0 To $iBound2 - 1
            $aOut[$i][$j] = $aArray[($iBound1 - 1) - $i][$j]
        Next
    Next
    Return $aOut
EndFunc  ;==>_ArrayReverse_2D

:)

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

  • 1 month later...

Very cool! This works great! I was having trouble displaying a multi-dimensional array and did not realize that _ArrayDisplay() did not support a multl-D array.

Thanks much!

Here's one that is:

#include <array.au3>

$list = WinList()
_ArrayDisplay($list)
$list = _ArrayReverse_2D($list)
_ArrayDisplay($list)

Func _ArrayReverse_2D($aArray)
    Local $iBound1 = UBound($aArray, 1)
    Local $iBound2 = UBound($aArray, 2)
    Local $aOut[$iBound1][$iBound2]
    
    For $i = 0 To $iBound1 - 1
        For $j = 0 To $iBound2 - 1
            $aOut[$i][$j] = $aArray[($iBound1 - 1) - $i][$j]
        Next
    Next
    Return $aOut
EndFunc ;==>_ArrayReverse_2D

:P

Link to comment
Share on other sites

  • Moderators

Very cool! This works great! I was having trouble displaying a multi-dimensional array and did not realize that _ArrayDisplay() did not support a multl-D array.

Thanks much!

_ArrayDisplay does support multi-dimensional arrays. What version of autoit are you using?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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