Skip to content
Andrey Vakhterov edited this page Jul 14, 2015 · 1 revision

Script files

All script files are located in directory plugins/VarScript/scripts with extension groovy.

Create script

File name can be any legal identifier — an unlimited-length sequence of Unicode letters and digits, beginning with a letter, the dollar sign $, or the underscore character _.

File example: plugins/VarScript/scripts/doTest.groovy:

println "doTest is called"
for (def arg in args) {
    println arg
}

Сall script

Call script without parameters:
/> doTest
/> doTest()
Call script with parameters:
/> doTest "foo", 1, me
/> doTest("foo", 1, me)

You can call script file from another script file or recursive.
Example, plugins/VarScript/scripts/factorial.groovy:

int value = args[0]
if (value <= 0) return 1
else return value * factorial (value-1)

/> println factorial(5) // prints 120

Clone this wiki locally