Hi,

Thanks a lot Mark and Trevor, as usual this list has proved to be worth its weight in RAM!

Something like "revLastExternalError". By always setting this variable to any error messages from within the external you maintain standard behavior for functions and have a variable to check for errors:

Except that if the function was non-external then you'd still have to have different code paths?

All the Best
Dave

On 10 Feb 2007, at 04:28, Trevor DeVore wrote:

On Feb 9, 2007, at 7:10 PM, Mark Wieder wrote:

If you set error to False you still have control over the result value
returned to the engine when your external routine exits. This is the
proper way to signal to the engine that an error has occurred, and
that way the script that called the external routine can parse the
result and determine whether or not an error has occurred.

For functions you will normally return your result in the "it"
variable and thus you have "the result" available for an error
message. I've got a writeup on this at

http://www.revjournal.com/tutorials/everything-you-know.html

Interesting article Mark. I wasn't aware that the result was set when calling functions.

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).

I think this is why I prefer something along the lines of a GetLastError() call. Or another option would be to define some other variable that was responsible for holding errors from external functions. Something like "revLastExternalError". By always setting this variable to any error messages from within the external you maintain standard behavior for functions and have a variable to check for errors:

put getTheNumberFour() into theNumberFour
if revLastExternalError is not empty then
answer "How did it mess up returning the number 4? (" & revLastExternalError & ")"
end if


--
Trevor DeVore
Blue Mango Learning Systems - www.bluemangolearning.com
[EMAIL PROTECTED]


_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to