简体   繁体   English

如何在 Java 中嵌入 Lua?

[英]How can I embed Lua in Java?

Is LuaJava a must for this? LuaJava 是必须的吗? Or can I embed Lua into Java without it?或者我可以在没有它的情况下将 Lua 嵌入到 Java 中吗?

LuaJ is easy to embed in Java. LuaJ 很容易嵌入到 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).我确实必须更改他们的源代码的几行才能使其按我预期的方式工作(它不需要自动使用 IO 库)。

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

还尝试甘露Mochalua

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

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 作者已经完成了这项工作 - 使用它比编写自己的更好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM