Externals Under 2.7.x

Trevor DeVore lists at mangomultimedia.com
Sun Feb 11 16:59:29 EST 2007


On Feb 11, 2007, at 10:52 AM, Mark Wieder wrote:

> Trevor-
>
> Saturday, February 10, 2007, 10:24:07 AM, you wrote:
>
>> variable.  For example, if you do this:
>
>> on mouseUp pMouseBtnNo
>>      put revXMLNodeContents(theNonExistentXMLTreeID,"no node") into
>> theContent
>>      put it & cr & theContent
>> end mouseUp
>
> Actually, that's not valid syntax. You'll get a compiler error if you
> turn on explicitVars.

Right.  But the purpose of the above snippet was not to demonstrate  
explictVars safe code, but rather that:

"The rev externals do return the error string as the result of the  
function but they don't explicitly store any value in the "it"  
variable".

If they did then the variable "it" would hold an empty value.

> There's no "it" variable at the time you try to
> display it because you've explicitly put the value into theContent.
> Try this instead:
>
> on mouseUp pMouseBtnNo
>    local theNonExistentXMLTreeID
>
>    get revXMLNodeContents(theNonExistentXMLTreeID, "no node")
>    put it & cr & the result
> end mouseUp

Now I get the following:

xmlerr, bad document id
xmlerr, bad document id

So both "it" and "the result" contain the error message which doesn't  
help.  What I am after in my code is a variable (or function) that  
can always be used to determine if an error occurred.  It will always  
return empty if no error occurred and will hold an error string if  
one did occur.  I want to do this without requiring a specific syntax  
when calling functions.  Using "it" (for the returned value) and "the  
result" (for the error string) only works if a certain syntax is used.

-- 
Trevor DeVore
Blue Mango Learning Systems - www.bluemangolearning.com
trevor at bluemangolearning.com





More information about the use-livecode mailing list