How do I run Lua scripts on Android in a Java application?

后端 未结 4 838
孤街浪徒
孤街浪徒 2021-02-01 09:29

I\'m developing an Android game in Java which uses Lua scripts. To execute these scripts, I\'m using LuaJ with Java\'s ScriptEngine class. For example...

ScriptE         


        
4条回答
  •  余生分开走
    2021-02-01 09:34

    However, this is apparently not supported on Android

    Correct.

    something to do with android not having a full blown JVM, I read somewhere

    Correct. If you look at the JavaDocs, you will see that javax.script does not exist in the Android SDK.

    Maybe I'll give this a try: https://github.com/damonkohler/sl4a

    That is one option. Another is to embed the Lua interpreter in your app via the NDK, as in this sample application.

提交回复
热议问题