Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can kscript used in Android project written in kotlin #411

Open
wisdomtl opened this issue Sep 23, 2023 · 1 comment
Open

Can kscript used in Android project written in kotlin #411

wisdomtl opened this issue Sep 23, 2023 · 1 comment

Comments

@wisdomtl
Copy link

I want to do this:

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        kscript.eval("val x =3")
        val result = kscript.eval("x+2")
        Log.d("test", "onCreate: result=$result")
    }
}

can kscript achieve this?

thanks for reading my stupid question.

@aartiPl
Copy link
Collaborator

aartiPl commented Sep 25, 2023

Well, they are saying that there are no stupid questions. And I kind of agree with that :-D

In the case of kscript, you can do something similar by calling KscriptHandler.handle() function. Please see at Kscript.kt and KscriptHandler.kt files. But please remember that currently, you need to have Kotlin compiler installed in the system, which is called internally by kscript. From that point of view, I think kscript is unsuitable for your use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants