Mottel
19th November 2002 05:01 UTC
Is pop "" possible?
The syntax Pop "" produces a compile error; but is there an alternative that lets you pop into thin air? i.e. without saving the value into a user-variable?
With only 20 user-variables, and all global, variables are a precious commodity in NSIS. ;) and I'd like to avoid using one where I don't need the popped value, e.g. where I'm only popping the stack to restore it to its previous state.
Smile2Me
19th November 2002 09:04 UTC
You can use a variable to pop and reuse it (overwrite) when you need to give it an important value.
If you really use all 20 variables and you still want to pop, then first push one variable onto the stack, switch the upper 2 stack items and pop twice. Like:
Push $0
Exch
Pop $0
Pop $0
and $0 will still have its own value, but now you deleted the top entry of the stack (so without loosing variables). You see, NSIS is so flexible, there is always a workaround for these things!
Have fun, good luck,
:-H
kichik
19th November 2002 16:22 UTC
I don't have much time to test it right now, but:
Exch $0
Pop$0
>
should work too, and it's a bit shorter ;)
Smile2Me
19th November 2002 16:44 UTC
Yep indeed, great :D
I like efficient coding :)
:-H
Mottel
20th November 2002 05:39 UTC
Yeah, but ...
Thanks guys,
Yeah, ... it's true that there are alternatives, but I still think that you should consider allowing the syntax: pop "" . It would be the natural 'mirror' instruction to: Push "some string constant". (Must admit though, Kichik's method *almost* makes it redundant. :up: )
(BTW, Kichik: I realised afterwards that "bitza" should have been "batzea." Although my (Alcalay) dictionary does give "bitza," it seems that it's not used in that form in the vernacular.)
kichik
20th November 2002 16:39 UTC
Well, it's the same in ktiv haser ;)
When I read it first I thought it was already batzea so I just assumed you somehow crossed a few letters in the English writing.