Call Java from C to call it from Lua
Posted: Sun Dec 08, 2013 4:20 pm
First I found a nice chatbot very advanced https://code.google.com/p/program-ab/ unfortunately the bot is in Java written
So I want is to use it in MM so seek possibles to bridge between Lua and Java.
First I found a lots of ways to use Lua in Java but that doesn't allow me to use it I want to call Java from Lua.
I found this http://www.codeproject.com/Articles/228 ... -Using-JNI a C/C++ API to do that.
I already found and complied https://github.com/jmckaskill/luaffi to call any foreign *.dll in Lua.
So the Pipe would be MM=>Lua=>FFI=>my.dll=>Java VM=>Chatbot
The problem I have is how I can save my Java VM Pointer, my C is little rusty but so far I remember I can't save anything(global var) in a *dll because it has no memory on its own. What is needed to save is struct so far I can see, anyone any idea?
So I want is to use it in MM so seek possibles to bridge between Lua and Java.
First I found a lots of ways to use Lua in Java but that doesn't allow me to use it I want to call Java from Lua.
I found this http://www.codeproject.com/Articles/228 ... -Using-JNI a C/C++ API to do that.
I already found and complied https://github.com/jmckaskill/luaffi to call any foreign *.dll in Lua.
So the Pipe would be MM=>Lua=>FFI=>my.dll=>Java VM=>Chatbot
The problem I have is how I can save my Java VM Pointer, my C is little rusty but so far I remember I can't save anything(global var) in a *dll because it has no memory on its own. What is needed to save is struct so far I can see, anyone any idea?