Lua (command line) remains open after execution

I searched all this for the sake of it, but I cannot find it. Is there a way to execute a Lua script by double-clicking on it (execute it in Lua (Command Line) ) and save it after execution?

For instance:

 print("Hello World") 

This code compiles and runs, however, if I double-click hello.lua , it starts and closes immediately without leaving any text on the screen. I want something more similar, but without the need to switch to Command Prompt , changing the directory several times, typing lua file.lua , etc.:

Command prompt

+6
source share
2 answers

The easiest way is to simply add a β€œpause” at the end of your script:

 print 'Hello World' os.execute 'pause' 
+7
source

Add io.read () at the end of your script.

+11
source

Source: https://habr.com/ru/post/947141/


All Articles