Hello Mark,

If you check empty = 0, you'll get false

I DO get false in the message box but in a handler where there is nothing being passed in the parameter I get the following (note that expressly putting empty into the parameter variable does give the expected result.)



if I call "MyHandler" with this inside a stack script:

on MyHandler tParam  --> where I didn't pass anything in tParam

          put isNumber(tParam) into tParamIsNumber
          put tParam = 0 into  tParamIsZero
          put (tParam is empty) into tParamIsEmpty

end MyHandler



it results in BOTH tParamIsZero = true AND tParamIsEmpty = true (it is empty and zero?)

also, tParamIsNumber = false AND tParamIsZero = true (it is not a number but it is zero?)


If I add the line:    put empty into tParam

on MyHandler tParam

          put empty into tParam
          put isNumber(tParam) into tParamIsNumber
          put tParam = 0 into  tParamIsZero
          put (tParam is empty) into tParamIsEmpty

end MyHandler

then ParamIsZero = false



Thanks for your help.

Scott Morrow
Elementary Software
(Now with 20% less chalk dust!)
web       http://elementarysoftware.com/

On Jul 9, 2009, at 1:56 PM, Mark Schonewille wrote:

Hi Scott,

If you check empty = 0, you'll get false, but if empty*1 = 0 will return true. AFAIK it has always been like this. I assume that tParam gets parsed when it is passed to a function or command handler. You can change the offending line of your script into: "put tParam is zero and tParam is not empty"

--
Best regards,

Mark Schonewille


On 9 jul 2009, at 22:18, Scott Morrow wrote:

I'm having trouble with a script where an empty parameter is evaluated as being zero. I've only been using rev 3.5 a short while so maybe I've missed a setting or new feature?
In the message box all works as expected:

 put empty into tVariable
 put charToNum(tVariable) --> (empty)
 put isNumber(tVariable) --> false
 put tVariable is zero --> false


but in my script, when the parameter is empty I get:

on tHandler tParam -- where tParam is empty
 put charToNum(tParam) --> (empty)
 put isNumber(tParam) --> false
 put tParam is zero --> true
end tHandler

if I explicitly < put empty into tParam > inside the script then all works as expected

I've not had a lot of sleep but hoped coffee and a maple bar might compensate.

Scott Morrow
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to