|
ZooMetropolis Newbie
Joined: 29 Mar 2003 Posts: 7
|
Posted: Sun Sep 21, 2003 1:51 am
Pop from string lists |
I'm breaking my head with this, i know it's an easy question, but i can't work it out.
How do i pop a value from a string list variable to another variable? |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Sun Sep 21, 2003 2:27 am |
#VAR astringlistvariable {item1|item2|item3}
#VAR anothervariable {%pop( astringlistvariable)} |
|
|
|
ZooMetropolis Newbie
Joined: 29 Mar 2003 Posts: 7
|
Posted: Sun Sep 21, 2003 8:19 am |
The problem I have with this is that when the second #VAR command is executed, the value on anothervariable is %pop( astringlistvariable). Meaning that i don't get the value item1 that i want.
|
|
|
|
ZooMetropolis Newbie
Joined: 29 Mar 2003 Posts: 7
|
Posted: Sun Sep 21, 2003 8:34 am |
I got it to work using %item and #DELN.. not the most elegant solution, but at least works :)
|
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Sun Sep 21, 2003 12:50 pm |
There's nothing wrong with %item and #DELN. That is the method you would use on older versions which don't have %pop, and does precisely the same thing. If the snippet I posted above doesn't work, you probably have one of those older versions.
#VAR anothervariable %item( @astringlistvariable, 1)
#DELN astringlistvariable 1 |
|
|
|
Anabasis Wanderer
Joined: 26 Jan 2001 Posts: 74
|
Posted: Mon Sep 22, 2003 2:48 pm |
quote: The problem I have with this is that when the second #VAR command is executed, the value on anothervariable is %pop( astringlistvariable).
I had a similar problem in some of my variable hand offs. I ended up solving it by putting brackets around the command to make sure it expands before assigning the value to the second variable, like so...
#VAR anothervariable {[%pop( astringlistvariable)]}
Ana |
|
|
|
|
|