Lua wait sleep

  • 使用os.execute 执行涉及等待、超时的外部命令、程序。配合 >nul 不显示标准输出流信息。执行过程是阻塞(block)等待的。
    • os.execute"ping 1.1.1.1 /n 1 /w <time in milliseconds> >nul"  ,如os.execute"ping 1.1.1.1 /n 1 /w 1000 >nul" 。
    • os.execute"CHOICE /n /d:y /c:yn /t:1 >nul" 。
    • 为(Windows)系统安装GNU命令包(minGW?)。

>sleep --help
Usage: sleep NUMBER[SUFFIX]...
or: sleep OPTION
Pause for NUMBER seconds. SUFFIX may be `s' for seconds (the default),
`m' for minutes, `h' for hours or `d' for days. Unlike most implementations
that require NUMBER be an integer, here NUMBER may be an arbitrary floating
point number.

--help display this help and exit
--version output version information and exit

Report bugs to <bug-coreutils@gnu.org>.

进而可以 os.execute"sleep 1" 。

原文地址:https://www.cnblogs.com/RobertL/p/14193336.html