Archive: Reverse Stack Order


Reverse Stack Order
I'm looking for a good way to reverse the order of everything in the stack. The the hard part is I may not know how many items are in the stack when I need it reversed. I tested the below code when I know I have only 5 items in the stack. Is there a better way?


OutFile Test.exe

Section ""

Push 1
Push 2
Push 3
Push 4
Push 5

Exch 4
Exch 1
Exch 3
Exch 1


Pop $0
MessageBox MB_OK "$0"
Pop $0
MessageBox MB_OK "$0"
Pop $0
MessageBox MB_OK "$0"
Pop $0
MessageBox MB_OK "$0"
Pop $0
MessageBox MB_OK "$0"

SectionEnd

Not that I know of. If you want to use dynamic arrays then use the script header in my sig. It has a reverse function built-in.

-Stu


I had post about it in feature requests:
http://sourceforge.net/tracker/index...49&atid=373088


Originally posted by Afrow UK
Not that I know of. If you want to use dynamic arrays then use the script header in my sig. It has a reverse function built-in.

-Stu
Hey Stu, just had a chance to change out some code, and put into place your arrays. They worked beautifully, thanks so much for you suggestion!:up: