Script termination

Started by garry23, December 11, 2017, 10:04:08 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

garry23

Hope someone can educate me.

At the moment one of my scripts, on loading for the first time, uses an IF-THEN-ELSE, which first detects that a lens is AF capable, and if it is it carries on with the script, ie loading variables, menus and function.

If the lens is not an AF one, the script simply shows a console message and does nothing else.

This means I need to put the main part of my script in the (main) IF-THEN-ELSE, like this:


IF test-true THEN
carry on with main script
ELSE
console-message
END


Is there a way to put a test, up front in a script, that checks things and then doesn't load the script?

Cheers

Garry

PS having been prompted by @dmilligan, I hope this is an X question, rather than a Y one  ;)

dmilligan


if test() == false then
    print("exiting...")
    return
end

garry23

@dmilligan

David

Can you please confirm that if I do a test such as that as the first few lines in my script, i.e. with a return, then the rest of the script won't be loaded.

Just tried it: thank you :)

Cheers

Garry