Script Function

Overview

This control behaves exactly as a Scripting Block, except it is designed to take some parameters and return one variable. It has the same use as a regular function () expect it can be called by all the different scripts presents in the workspace where a user written one would have to be defined in each script.

Example

We want to create a non existant function, for example the XOR logical operation between two booleans. Note that XOR returns a logical '1' when only one of the two inputs is at '1'. For that, we would define it as follows in a script function :

Now, to test it, we will need to call this function with, for example, one Button and some script associated to its click action :

This will output in the console the following text :

We can finally see that it is working as intended. Now this function can be used in the whole workspace with the same syntax, by all the scripting components.