PDA

View Full Version : Reverse Stack Order


Jnuw
20th May 2005, 22:02
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

Afrow UK
20th May 2005, 22:17
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

Instructor
21st May 2005, 05:06
I had post about it in feature requests:
http://sourceforge.net/tracker/index.php?func=detail&aid=1184330&group_id=22049&atid=373088

Jnuw
3rd June 2005, 22:34
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: