Skip to content

Commit

Permalink
load engine from ScriptEngineManager
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon committed May 8, 2018
1 parent 55eb005 commit 0326359
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/kotlin/de/swirtz/ktsobjectloader/KtsObjectLoader.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package de.swirtz.ktsobjectloader

import org.jetbrains.kotlin.script.jsr223.KotlinJsr223JvmLocalScriptEngine
import org.jetbrains.kotlin.script.jsr223.KotlinJsr223JvmLocalScriptEngineFactory
import java.io.Reader
import javax.script.ScriptEngineManager

class KtsObjectLoader {

val engine =
KotlinJsr223JvmLocalScriptEngineFactory().scriptEngine as KotlinJsr223JvmLocalScriptEngine
val engine = ScriptEngineManager().getEngineByExtension("kts")
as KotlinJsr223JvmLocalScriptEngine

inline fun <reified T> load(script: String): T {
val loaded: Any = engine.eval(script)
Expand Down

0 comments on commit 0326359

Please sign in to comment.