External: Throw

Alex Rice alrice at arcplanning.com
Fri Aug 29 00:41:01 EDT 2003


On Thursday, August 28, 2003, at 07:37  PM, Brian Yennie wrote:

> Externals have both "pass" and "error" arguments passed to their 
> functions.
>
> Try setting one (or both) to true- I haven't experimented with them 
> myself, but I assume that one passes the message and the other throws 
> an error.

Setting pass to True, then returning from the function, is like the 
pass command in transcript - like you guessed.

But setting error to true, then returning from the function, is not the 
same as "throw". Setting error to true causes script execution to stop- 
I believe like "exit to top" in transcript. Here is a comment from 
external.c in the SDK:

   /* only set error to true when a syntax error occurs, as it
        causes the script to stop execution at this point */
   *error = True;
   *retstring = istrdup("printf: must pass 2 arguments");


I sure don't see anything in XCmdGlue.h about throw. Dar how about this?
EvalExpr("throw reallyBadExternalCondition", &retvalue); /*  untested */

Alex Rice, Software Developer
Architectural Research Consultants, Inc.
http://ARCplanning.com




More information about the use-livecode mailing list