我怎样才能在java中嵌入lua?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2113432/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 03:40:39  来源:igfitidea点击:

how can I embed lua in java?

javalua

提问by

is LuaJava a must for this? or can I embed lua into java without it?

LuaJava 是必须的吗?或者我可以在没有它的情况下将 lua 嵌入到 java 中吗?

回答by Manfred Moser

There is http://www.keplerproject.org/luajava/manual.html, but essentially lua is more suitable for integration with C. There are a bunch of other scripting languages with good java integration around though. Consider groovy, jruby or jython for starters.

http://www.keplerproject.org/luajava/manual.html,但本质上 lua 更适合与 C 集成。不过,还有许多其他脚本语言具有良好的 Java 集成。首先考虑 groovy、jruby 或 jython。

回答by nos

Lua is a C library, you can embed it in Java but you'll have to interface the java virtual machine and Lua with some C code.

Lua 是一个 C 库,您可以将它嵌入到 Java 中,但是您必须将 Java 虚拟机和 Lua 与一些 C 代码连接起来。

The LuaJava authors have already done that work - you're better off using that than writing your own.

LuaJava 作者已经完成了这项工作 - 使用它比编写自己的更好。

回答by lhf

Try also kahluaand Mochalua.

还尝试甘露Mochalua

回答by Ben Ziegler

LuaJ is easy to embed in Java. I did have to change a few lines of their source to get it to work how I expected (it didn't require the IO library automatically).

LuaJ 很容易嵌入到 Java 中。我确实必须更改他们的源代码的几行才能使其按我预期的方式工作(它不需要自动使用 IO 库)。

http://sourceforge.net/projects/luaj/

http://sourceforge.net/projects/luaj/