KotlinScript
A script engine wrapper for dynamically evaluating Kotlin source code using the kts extension.
Manages variable bindings via the JSR 223 Bindings mechanism, generates Kotlin val declarations that cast bound values to their appropriate types, and prepends import statements to evaluated code.
Common literal JVM-termination calls (System.exit, exitProcess, Runtime.getRuntime().exit/halt) are rejected on a best-effort basis via ScriptGuards; bare System.exit is additionally shadowed by the auto-imported System object. This is a convenience against accidental termination, not a security sandbox (see ScriptGuards) — run untrusted scripts in an isolated process or JVM.
Parameters
nullGlobalContext
if true, sets the global scope bindings to null on initialization