Please have a look at this
Basically you need to use
method to create the scope within which the script is going to run and then set the variables (
) you want to pass to the script in it. The script can refer to these variables using the key specified in setVariable call.