|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Sun Dec 09, 2007 2:37 pm
[2.16] #DELITEM and #FORALL with regular variable |
Guess what local variables seem to work great, but I guess we all forgot about regular variables.
1. Launch CMud
2. Close Sessions window (ESC)
3. Enter at the command line
Code: |
DestTemp={a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y};#FORALL @DestTemp {#SHOWP {%i"-"};#DELITEM DestTemp {%i};#SHOW @DestTemp} |
You will notice the list only gets half of its treatment.
4. Enter at the command line
Code: |
DestTemp="a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y";#FORALL @DestTemp {#SHOWP {%i"-"};#DELITEM DestTemp {%i};#SHOW @DestTemp} |
Now the #FORALL works to go through the whole list. The use of quotes changed the variable type causing seperate hash tables to be made.
5. Enter at the command line
Code: |
DestTemp={a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y};#FORALL @DestTemp {#SHOW %i} |
Here we see that the problem is in changing the hash table that #FORALL was referencing. I am afraid to try #ADDITEM because I can imagine it going to an infinite loop. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Sun Dec 09, 2007 8:36 pm |
Confirmed.
|
|
_________________ Asati di tempari! |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Dec 11, 2007 6:21 pm |
Yep, confirmed. The #FORALL is using the "live" hash table instead of making a copy of it at the beginning of the loop. Added to bug list.
|
|
|
|
|
|