lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I had already use shell code in my java program... So I think it's possible to do like that :

System.execute("lua my_script.lua").

But I want to use special API of jdk6 like that

//js code
String x = "var out = new java.lang.StringBuffer();\nfor (i=0; i<3; i++)\nout.append('hello, world! ('+i+')\\n');";

//call engine...
javax.script.ScriptEngineManager manager = new javax.script.ScriptEngineManager();
//and get interpreter
javax.script.ScriptEngine jsengine = manager.getEngineByName("js"); 
  try {
  jsengine.eval(x);
  String out = new String((StringBuffer)jsengine.get("out"));
  System.out.println(out);
}
catch Exception { }

So I want use the same sample, but with an lua interpreter.

Thanks a lot !



--
Frédéric ASTIC
06.25.91.07.04