External: Throw

Brian Yennie briany at qldlearning.com
Thu Aug 28 20:44:01 EDT 2003


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.

Most of my externals look something like:

void magicExternal(char *args[], int nargs, char **retstring, Bool 
*pass, Bool *error) {
     char* retstr = (char*)malloc(32);
     sprintf(retstr, "My favorite number is %d", atol(args[0]));
         ...

cleanup:
	
     *error = false;
     *pass = false;
	
     if (retstr == NULL) retstr = (char*)calloc(1,1);
	
     *retstring = (char*)calloc(strlen(retstr) + 1 ,1);
	
     BlockMoveData(retstr, *retstring, strlen(retstr));
	
     free(retstr);
}

Try throwing in a "true" for error and see what happens!

Brian

> Is there a way to throw from an external and have it caught in 
> Transcript?
>
> Dar Scott
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 1539 bytes
Desc: not available
URL: <http://lists.runrev.com/pipermail/use-livecode/attachments/20030828/bf1e9f1d/attachment.bin>


More information about the use-livecode mailing list