MrHappyAsthma
MrHappyAsthma

Reputation: 6522

Lua (Command Line) remain open after execution

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?

For example:

print("Hello World")

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.:

Command Prompt

Upvotes: 6

Views: 4114

Answers (2)

Paul Kulchenko
Paul Kulchenko

Reputation: 26794

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

Upvotes: 11

greatwolf
greatwolf

Reputation: 20858

The easiest way would be to just add a 'pause' at the end of your script:

print 'Hello World'
os.execute 'pause'

Upvotes: 7

Related Questions