Skip to content

Script object

Sven Rahn edited this page Jun 29, 2018 · 1 revision

Every script has an individual Script object. The source code is here.

It contains the script ID and the path to the script file. You can also compile and run other scripts with the script object.

val path = script.path // own path to the script file
val configPath = path.parent.resolve("config.conf")
val loader = configPath.toConfigurationLoader()
val myId = script.id
val compiledScripts = script.compile(script.path.parent.resolve("lib.ktskript"))
val libFunctions = compiledScripts["lib"]!!.compiledScript.eval()
// do other stuff, see the 'Scripts as libraries' wiki page
Clone this wiki locally