How does one go about implementing a scripting engine (I'm thinking Jython) into Java?
I've never done this before, so one major question that I have is; how does the scripting engine know what function calls or fields are available to it?
Is there a simple tutorial to follow on implementing jython into a game? A book possibly?
如果你的路径中有jython.jar,你可以启动一个PythonInterpreter ,它可以执行和编译字符串和文件,你可以从中获取python对象(字符串,整数,对象,函数)。
I created a Java interface and implemented that java interface using python. That way when you get the python class back as a java instance you can type cast it to the interface and know what methods are available. __call__
and __tojava__
are the jython methods to get an instance back from a python implementation.
The Jython Book has a pretty good example and tutorial on how to do this.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.