开发者

LuaJava not running script until close

I have added loading and executing of lua scr开发者_如何学JAVAipts to java using LuaJava, but when I run a script such as:

print("works")

It won't show up until after the program has stopped running.

This is my Java code:

LuaState state = LuaStateFactory.newLuaState();
state.openLibs();
state.LdoString(scripts.get(name));
state.close();

EDIT: Fixed using this code:

LuaState state = LuaStateFactory.newLuaState();
state.openLibs();
state.LloadString(scripts.get(name));
state.call(0, 0);
state.close();


The stream used for stdout/stderr is buffering the data. You'll need to explicitly flush the buffer in question. For example. you might try 'state.LdoString("io.flush();");

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜