Jump to content
Sign in to follow this  
Champak

_ArrayReverse question

Recommended Posts

Champak

Is it multidimentional?

Share this post


Link to post
Share on other sites
Champak

Thanks.

Share this post


Link to post
Share on other sites
monoceres

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!

Share this post


Link to post
Share on other sites
DickG

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

Share this post


Link to post
Share on other sites
SmOke_N

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.

Share this post


Link to post
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
Sign in to follow this  

×