Externals Under 2.7.x

Trevor DeVore lists at mangomultimedia.com
Fri Feb 9 13:38:46 EST 2007


On Feb 9, 2007, at 9:18 AM, Dave wrote:
>> One other thing to keep in mind: In your code you are setting  
>> *theErrorFlagPtr to True if an error occurs.  This will produce an  
>> error dialog in Revolution but I'm not sure if you can see the  
>> error string that you put in *theResultPtrPtr anywhere which is  
>> unfortunate.  So another possibility is that your function is  
>> returning an error and that is the dialog that Rev is displaying.   
>> Until I find out how to display the actual error string if  
>> theErrorFlagPtr == True I've resorted to always setting it to  
>> false and handling the errors in Revolution itself.
>
> In my case it wasn't returning an error, but, I wondered about this  
> too. It seems weird that you can't seem to get an error signal and  
> then get an error message if there is an error.
>
> If you set the error flag to false, then how can you tell if the  
> data returned is an error message or if it's good data??

If you write a COMMAND then you can make use of the "it" local  
variable and the result.  Put the data the command returns (if any)  
into the "it" local variable and put any errors into the result (the  
value you assign to the first parameter Rev passes to your external  
function).

If you write a FUNCTION then you have a couple of options:

a) use some sort of error prefix (i.e. "revdberr,") and check for that
b) pass the name of a variable to the function that you will store  
error info in
c) write a GetLastError() function for you external that returns the  
error (if any) of the last function called in your external

These days I think (c) is the best option.


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





More information about the use-livecode mailing list