Page 1 of 1

Call Java class in Lua Android

Posted: Thu Oct 24, 2019 8:47 pm
by AdrianN
Hi, I successfully build apk using this repository.

https://bitbucket.org/MartinFelis/love- ... /src/11.2/

Now I am trying to use the bluetooth function. I have the code to a previously project, to make the connection.
But I no have any idea how to call the class in lua.

I used a little FFI in my projects, but I don't know how to call JNI.

Search in the forum I found this Library https://bitbucket.org/bartbes/jniwrap

I honestly don't know how it works and the project structure, but I receive the following error, using test.lua in this repository to call ExtraTest.java

Code: Select all

--main.lua
require "test"
I/SDL/APP: [LOVE] ERROR: test.lua:10: undefined symbol: getGlobalEnv

How should I do to call a Java class in Lua code in Android.

Re: Call Java class in Lua Android

Posted: Fri Oct 25, 2019 7:01 am
by raidho36
I'd suggest you implement this as a LOVE module. It's a straightforward and self-explanatory process.

Re: Call Java class in Lua Android

Posted: Fri Oct 25, 2019 7:00 pm
by AdrianN
raidho36 wrote: Fri Oct 25, 2019 7:01 am I'd suggest you implement this as a LOVE module. It's a straightforward and self-explanatory process.
Do you mean adding a custom library, instead jniwrap, using c ++ code?

Like admob library https://bitbucket.org/bio1712/love2d-ad ... ules/ads/

I don't understand where exactly to put each part of JNIWrap in the project. I build but now I has another error haha.