Lua(命令行)在执行后保持打开状态 [英] Lua (Command Line) remain open after execution

查看:317
本文介绍了Lua(命令行)在执行后保持打开状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经搜索了很多,但是似乎找不到.有没有办法通过双击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.luait 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆