Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/388.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Luaj/Java:我们如何将数据返回到Java?_Java_Lua_Luaj - Fatal编程技术网

Luaj/Java:我们如何将数据返回到Java?

Luaj/Java:我们如何将数据返回到Java?,java,lua,luaj,Java,Lua,Luaj,我正在学习Lua和LuaJ Java库。我了解了如何创建和运行脚本: String script = "message = 'Hello World!'"; InputStream input = new ByteArrayInputStream(script.getBytes()); Prototype prototype = LuaC.compile(input, "script"); LuaValue globals = JsePlatform.standardGlobals(); Lua

我正在学习Lua和LuaJ Java库。我了解了如何创建和运行脚本:

String script = "message = 'Hello World!'";
InputStream input = new ByteArrayInputStream(script.getBytes());
Prototype prototype = LuaC.compile(input, "script");
LuaValue globals = JsePlatform.standardGlobals();
LuaClosure closure = new LuaClosure(prototype, globals); 
LuaValue value = closure.call();

如何将Lua变量的值
消息
返回Java,并通过
LuaValue
访问它?这可能吗?

返回消息
添加到脚本末尾?噢,是的,就是这样。谢谢