https://kotlinlang.org logo
Title
u

user

07/23/2022, 4:41 PM
Can't put variables for kts script engine in kotlin I have this code: fun main() { with(ScriptEngineManager().getEngineByExtension("kts")) { put("i", 3) val res2 = eval("i") println(res2) } } which gives me this error: Exception in thread "main" javax.script.ScriptException: error: unresolved reference: i i ^ The evaluation works fine, if I dont try to reference the variable it all works fine. What am I doing wrong to add a variable?