Lua(命令行)在执行后保持打开状态 [英] Lua (Command Line) remain open after execution
问题描述
我已经搜索了很多,但是似乎找不到.有没有办法通过双击Lua
脚本(在Lua (Command Line)
中执行)并在执行后保持打开状态来执行该脚本?
I have searched far and wide for this but I cannot seem to find it. Is there any way to execute a Lua
script via double clicking it (to execute it in Lua (Command Line)
) and keep it open after execution?
例如:
print("Hello World")
此代码可以编译并运行,但是,如果我双击hello.lua
,它将运行并立即关闭,而不会在屏幕上留下我的文本.我想要更多类似的东西,但不必转到Command Prompt
,无需多次更改目录,键入lua file.lua
等.
This code compiles and runs, however if I double click on hello.lua
it runs and closes immediately without leaving my text on screen. I want something more like this, but without having to go to Command Prompt
, changing directory a bunch of times, typing lua file.lua
, etc.:
推荐答案
最简单的方法是在脚本末尾添加暂停":
The easiest way would be to just add a 'pause' at the end of your script:
print 'Hello World'
os.execute 'pause'
这篇关于Lua(命令行)在执行后保持打开状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!