Join Slack
Powered by
I'm wondering if it's possible to make a script ha...
# scripting
z
zt
08/07/2023, 4:57 PM
I'm wondering if it's possible to make a script have access to the current runtime variables?
i
ilya.chernikov
08/10/2023, 10:05 AM
I'm not sure I understand, what you mean. There is the JSR-223 support though, it allows you to embed a scripting/repl engine and pass references to the current runtime objects to your scripts. See e.g. some examples here -
https://github.com/Kotlin/kotlin-script-examples/blob/master/jvm/jsr223/jsr223-simple/src/test/kotlin/org/jetbrains/kotlin/script/examples/jvm/jsr223/simple/test/simpleJsr223Test.kt
Maybe it will answer your question.
p
PixelHamster
08/10/2023, 10:11 AM
you can also without scriptengine
PixelHamster
08/10/2023, 10:11 AM
https://github.com/Melijn/melijn-bot/blob/master/bot/src/main/kotlin/me/melijn/bot/utils/script/scriptDef.kt#L45
example
z
zt
08/10/2023, 2:55 PM
@PixelHamster
perfect, im also using kotlin scripting in my kotlin discord bot
p
PixelHamster
08/10/2023, 3:09 PM
Glad I could help
2
Views
Open in Slack
Previous
Next