Call Java from C to call it from Lua

Discuss, ask for help, share ideas, give suggestions, read tutorials, and tell us about bugs you have found with MicroMacro in here.

Do not post RoM-Bot stuff here. There is a subforum for that.
Forum rules
This is a sub-forum for things specific to MicroMacro.

This is not the place to ask questions about the RoM bot, which uses MicroMacro. There is a difference.
Post Reply
Message
Author
User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Call Java from C to call it from Lua

#1 Post by BlubBlab » 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?
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

User avatar
Administrator
Site Admin
Posts: 5306
Joined: Sat Jan 05, 2008 4:21 pm

Re: Call Java from C to call it from Lua

#2 Post by Administrator » Sun Dec 08, 2013 9:32 pm

That seems overcomplicated and difficult.

It might instead be easier to write some bindings so that you can use functions from that library in Lua. Basically, you want to export a .DLL where the exposed functions are Lua callbacks. Now, just drop this into MicroMacro's plugin directory and you're done.

Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests