 |
GeneralStonewall Magician
Joined: 02 Feb 2004 Posts: 364 Location: USA
|
Posted: Tue Jun 29, 2010 10:00 am
[3.21] BUG: Infinite loop with #delitem |
I believe this may be related to http://forums.zuggsoft.com/forums/viewtopic.php?t=35420
The following script causes an infinite loop:
| Code: |
#print ""
#print "---- Setting up testdb ----"
#var testdb %null
#addkey testdb key1 val1
#print {testdb: %expanddb( @testdb)}
#print "Executing #forall loop nested in #loopdb"
#loopdb @testdb {
#forall %val {
#delitem testdb.%key {%i}
}
} |
If the #delitem is replaced with an #echo, then there's no issue. |
|
|
|
 |
Tech GURU

Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Tue Jun 29, 2010 1:38 pm |
Infinite loop confirmed and it looks like the #delitem is somehow resetting (or not advancing) the outer loop db. That some pretty wonky code though. What exactly were you trying to do when you came across this? I'm pretty sure theres a better way to do it.
|
|
_________________ Asati di tempari! |
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Jun 29, 2010 4:55 pm |
Hmm, interesting. Looks like #loopdb isn't making a proper copy of the table somehow. Although the #FORALL statement is also suspect because you are looping on a string value (val1) and not a real string list.
|
|
|
|
 |
|
|
|