return
¶
Syntax¶
Description¶
This command causes the script execution to leave previously called function with callfunc()
or script with callsub()
and return to the location, where the call originated from. Optionally a return value can be supplied, when the call was done using the function form.
Using this command outside of functions or scripts referenced by callsub()
will result in error and termination of the script.
Examples¶
set(.@var, callsub(L_myAddition, .@a_val, .@b_val));
mes("The result is " + .@var + ".");
close();
L_myAddition:
return getarg(0) + getarg(1);
set(.@var, callfunc("MyAddition", .@a_val, .@b_val));
mes("The result is "+.@var+".");
close();
// ...
function script MyAddition {
return getarg(0) + getarg(1);
}
Info
Assuming .@a_val and .@b_val being 1, both examples would yield a message displaying, that the result is 2.