How to run scripts in Lua with java program? [closed]

0

I want to learn how to develop, combining more than one programming language, using java with moon scripts.

    
asked by anonymous 01.12.2017 / 14:18

1 answer

1

LuaJ offers a very simple integration interface between Java and the Moon.

import org.luaj.vm2.*;
import org.luaj.vm2.lib.jse.*;

Globals globals = JsePlatform.standardGlobals();
LuaValue chunk = globals.loadfile("examples/lua/hello.lua"); // seu script lua
chunk.call();

You can save the returned value from chunk.call() to a variable. This is the result of the executed script. Font

LuaJ is fully open source and is in GitHub .

    
01.12.2017 / 14:20