Easiest way to make lua script wait/pause/sleep/block for a few seconds?

前端 未结 19 1362
礼貌的吻别
礼貌的吻别 2020-12-03 00:41

I cant figure out how to get lua to do any common timing tricks, such as

  • sleep - stop all action on thread

  • pause/wait - don\'t go on to the

19条回答
  •  攒了一身酷
    2020-12-03 01:30

    I started with Lua but, then I found that I wanted to see the results instead of just the good old command line flash. So i just added the following line to my file and hey presto, the standard:

    please press any key to continue...
    
    os.execute("PAUSE")
    

    My example file is only a print and then a pause statment so I am sure you don't need that posted here.

    I am not sure of the CPU implications of a running a process for a full script. However stopping the code mid flow in debugging could be useful.

提交回复
热议问题