Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using bindings in Kotlin Script (Jsr 223)

Tags:

kotlin

jsr223

I try to follow this example to embed a Kotlin Script. But if try to use the bindings map in my script

val unit = bindings["unit"] as Entity

I get a syntax error (unresolved reference of bindings) and cannot compile the project (in Intellij I created a kts file for the script). How can I resolve this ?

like image 370
Marco Avatar asked Mar 02 '26 12:03

Marco


1 Answers

In the current version on Kotlin you no longer need to use the bindings map. Just access it as a normal variable (unit).

like image 165
RoToRa Avatar answered Mar 05 '26 07:03

RoToRa