lua-users home
lua-l archive

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


On 6/12/07, Luc1an0 <luc1an0@free.fr> wrote:
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").

Well, you don't need LuaJava for that :)

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.

If I understood correctly, all one needs to do is to create the appropriate adapter classes (using javax.script), which call LuaJava to do the grunt work. Doesn't seem particularly hard, but I never got around to actually doing it, so I dunno :)

[]'s
_______________________
Humberto S. N. dos Anjos

"Why are programmers non-productive?  Because their time is wasted in meetings.
Why are programmers rebellious?  Because the management interferes too much.
Why are the programmers resigning one by one?  Because they are burnt out.
Having worked for poor management, they no longer value their jobs."
-- Tao of Programming, Book 6