-
Notifications
You must be signed in to change notification settings - Fork 5
Scripts as libraries
Sven Rahn edited this page Jun 29, 2018
·
2 revisions
Other scripts can be compiled from within a script. If a script was already compiled, the cached version is returned instead.
val compiledScripts = script.compile(script.path.parent.resolve("lib.ktskript"))
You can also just specify a folder where every file should be targeted:
val compiledScripts = script.compile(script.path.parent.resolve("libs"))
Then get the scripts you want and run them. That is one possible way of doing libraries. See the library example here.
The library returns a Map<String, Function<*>>
. The script which uses the lib can then cast and call the lib functions.