|
aduan Newbie
Joined: 12 Jul 2008 Posts: 4
|
Posted: Sun Jul 13, 2008 4:03 pm
%key, %val challenge |
I have the following problem since i updated to cmud.
This executes just fine. However it won't set the value to 0. I am trying to set the value belonging to the current key to 0 and somehow i'm at a loss there.
#loopdb @herbafflictions {#if (@illprev.illherb=%val) {#var herbafflictions.%key 0}
I'd really appreciate a clue here. |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sun Jul 13, 2008 4:29 pm |
Two options:
#addkey herbafflictions %key 0
or
#var %concat("herbafflictions.",%key) 0
The reason this fails is that the %key is being seen as part of the literal string that makes up the variable name, and isn't evaluated. You end up setting the key "%key" (that is, the string "%key") to 0 instead. |
|
|
|
|
|