Lua Scripting Engine for Java
A Lua Java Scripting Engine, built on top of the excellent LuaJava library. Allows users to embed Lua scripts in Java using the standard Java 1.6 scripting extensions. LuaJava is the real work-horse the scripting engine is just an adapter to allow LuaJava to expose itself as a Java scripting engine. Below is an example:
ScriptEngineManager manager = new ScriptEngineManager(); ScriptEngine engine = manager.getEngineByName("lua"); List testList = new ArrayList(); engine.put("age", 21); engine.put("testList", testList); Object i = engine.eval("sys = luajava.bindClass(\"java.lang.System\") " +"sys.out:println( sys:currentTimeMillis() ) " + "if (age >= 22) then " + " sys.out:println('Old enough to vote!') " + " else " + " sys.out:println ('Back to school!')" + "end" + " testList:add (\"in list\") "); System.out.println(testList.get(0)); |
Requires:
- Java 1.6+.
- LuaJava properly built and installed
Binary: luaScriptEngine.jar
Source Zip: luaScriptEngine-src.zip
If you like what you see, or even if you don’t, please let me know. cynical at cynicalmonkey dotcom.




