 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5187
|
Posted: Sun Dec 02, 2007 2:26 pm
[2.14] #ADDITEM/#ADDKEY and #IF with local var |
For some reason when a local variable has its contents set by #ADDITEM it fails this non null test
| Code: |
$Used=""
#ADDITEM $Used {some}
#IF ($Used) {
#SHOW Passed if $Used
} {
#SHOW Failed if $Used
} |
It continues to fail with multiple #ADDITEMs. Setting a value other then "" initially works unless the variable gets set to null along the way. An expression of $var!="" does work, so it is just the non expression.
This also fails
| Code: |
| $USED="";#ADDKEY $USED {test} {Tesy};#IF ($USED) {#SHOW yes} {#SHOW Failed $USED} |
|
|
_________________ 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 02, 2007 8:08 pm |
Confirmed.
|
|
_________________ Asati di tempari! |
|
|
 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5187
|
Posted: Mon Dec 03, 2007 4:26 pm |
We can also add #RESULT to the commands that get a null value returned after #ADDITEM.
| Code: |
<func name="DirConvert" type="StringList" id="16">
<value>#IF ($dir="") {
#SHOW Error in DirConvert: null direction passed
#RETURN ""
}
$Res=""
#FORALL $dir {
#ADDITEM $Res {%reversedir(%reversedir(%exec(%concat(%pref(iMoveChar),%i))),1)}
}
#SAY $Res
#RESULT $Res</value>
<arglist>$dir</arglist>
</func> |
Drop that function in then enter at the command line
| Code: |
| #SHOW @DirConvert("h|j|k|l") |
You will see the #SAY can get the value, but #RESULT can not. That makes this not a problem in #IF. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Dec 03, 2007 6:48 pm |
Added to bug list as two separate bugs since I'm not sure they are caused by the same problem yet.
|
|
|
|
 |
|
|
|