用Java封装Lua API
我正在尝试用 Java/Scala(一种 JVM 语言)编写一个大型项目来扩展现有的程序,但问题是 API 是用 Lua 编写的。
我找到了一个声称能够从 Lua 访问 Java 和从 Java 访问 Lua 的网站列表:
- http:// www.keplerproject.org/luajava/
- http://code.google.com/p/ jnlua/
- https://www.github.com/dafrito/jna-lua
程序中我的项目正在扩展,通过在文件中加载特定脚本来工作。相反,我想从 JVM 项目运行所有内容。
在其他作品中:我需要能够调用 Lua 文件中的函数,该文件是通过类似反射的系统从 java 项目加载的。
以前有人做过这样的事情吗?是否可以?您会推荐某个 Java 库吗?路亚连接?您会推荐一个替代方案吗?
谢谢您的宝贵时间!
I'm trying to write a large scale project in Java/Scala(a JVM language) that extends a preexisting program, but the problem is that the API is written in Lua.
I have found a list of websites that claim to be able to access Java from Lua and Lua from Java:
- http://www.keplerproject.org/luajava/
- http://code.google.com/p/jnlua/
- https://www.github.com/dafrito/jna-lua
The program in which my project is extending, works by loading a certain script within a file. Instead, I want to run everything from a JVM project.
In other works: I need to be able to call functions within a Lua file that is loaded via a reflection-like system from a java project.
Has anyone done something like this before? Is it possible? Would you recommend a certain library for Java <-> Lua connection? Would you recommend an alternative?
Thank you for your time!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试 LuaJ 或 卡鲁瓦。我都用过,而且都有效。 LuaJava 和 jnlua 一样工作。我知道使用这两种方法的项目,但我自己并不知道。
所以你有 4 个可供选择。没有“最好”的一种,每种都有一些优点和缺点。这实际上取决于你想做什么。
You might try LuaJ or Kahlua. I have used both, and they work. LuaJava works as well as jnlua. I know projects using both though I don't myself.
So you have 4 to pick from. There isn't a "best" one, each one has some pluses and minuses. It really depends on what you want to do.