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

后端 未结 4 835
孤街浪徒
孤街浪徒 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:36

    Instead of LuaJ you can (also) use LuaJava together with Lua compiled for Android using the NDK. This allows Lua full access to whatever is available from Java. Take a look at this example to see how to get started.

    Lua 5.1.4 + LuaJava compiled are provided in the libs directory (a single libluajava.so file) if you do not want to fiddle with the NDK, but it is relatively easy to set up anyway.

提交回复
热议问题