Externals Under 2.7.x

Trevor DeVore lists at mangomultimedia.com
Sat Feb 10 13:24:07 EST 2007

On Feb 10, 2007, at 10:02 AM, Mark Wieder wrote:

>> As for storing your result in the "it" variable, one potential issue
>> I see (if I am understanding correctly) is that functions defined in
>> an external would have different basic behavior than functions
>> defined in Revolution (Transcript).  Any function defined in an
>> external would have to be called like this in order to work properly:
>> put getTheNumberFour() into theError
>> answer it -- CONTAINS THE NUMBER "4"
>> because if the user called the external function like this:
>> get getTheNumberFour()
>> then both "it" and "the result" would contain the error message.
>> Plus you would lose the ability to put result of the function into a
>> meaning variable name without adding another assignment (i.e. put it
>> into theMeaningVariableName).
> Actually that's the way functions work. The internal db and xml
> handlers return a value to you and you have to check the result to see
> if it (trying to refer to these natural language syntax values is
> getting a bit difficult) to see if it contains "revxml err" or
> something like 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.  For example, if you do this:

on mouseUp pMouseBtnNo
     put revXMLNodeContents(theNonExistentXMLTreeID,"no node") into  
     put it & cr & theContent
end mouseUp

The message box would print:

xmlerr, bad document id

Whereas with your interesting trick it would be empty I believe.

So with the rev externals you end up checking the same value for  
either an error string or the returned value.  This is the method  
like least of all for error reporting.

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

More information about the Use-livecode mailing list