Re: LuaJIT for Android

  • From: Michal Kottman <k0mpjut0r@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Sun, 19 Aug 2012 22:03:10 +0200

On 19 August 2012 18:59, Henk Boom <henk@xxxxxxx> wrote:
> Interesting, are there any advantages to using LuaJava over the NDK
> through the ffi? I would think that using e.g. OpenGL through the NDK
> would be more efficient due to less vm->vm data wrangling, is that
> right?

If you only require OpenGL, then yes, FFI would be better. However if
you want to do anything other (create the GUI, get the GPS location,
etc. then you need to call the Android API using Java. Only some
low-level classes are implemented in C/C++, mainly regarding

LuaJava is a two-way bridge between Lua and Java, meaning that you can
call Java code from Lua and also call Lua code from Java. The second
direction requires several "native" functions implemented in C which
are exported from the module. If you are willing to lose the ability
to call Lua code from Java and have some other way to start the
application than the normal way from Java (like native-activity from
the Android NDK samples), then maybe the FFI would be enough to call
the JNI to interact with Java. I did not try this however, so this is
very theoretical.

Other related posts: