We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JavaFunction sleep = new JavaFunction(L) { @Override public int execute() throws LuaException { int time = L.toInteger(2); try { Thread.sleep(time); }catch (Exception e){ e.printStackTrace(); } return 1; } }; sleep.register("sleep");
例子: print(1) sleep(6000) print(2)
问题:sleep()和print等函数一起使用时,延时6秒后才同时打印出1和2(而不是先打1过6秒后打2) 有什么好方法吗?
The text was updated successfully, but these errors were encountered:
lua 没有 sleep 的完美方案。我也是苦恼了很久。一个变通办法是利用 callback,具体代码见 demo 里的 callback。
谁有更好的方案欢迎补充~
Sorry, something went wrong.
有没有可能,我是说可能, 你在sleep之前,先flush一下print的缓冲区就行了呢?
No branches or pull requests
例子:
print(1)
sleep(6000)
print(2)
问题:sleep()和print等函数一起使用时,延时6秒后才同时打印出1和2(而不是先打1过6秒后打2)
有什么好方法吗?
The text was updated successfully, but these errors were encountered: