This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
lordxarus's profile picture

[Lua] [Question] Wait for user input

Started by lordxarus, 06 February 2013 - 11:14 AM
lordxarus #1
Posted 06 February 2013 - 12:14 PM
I have a program that prints text and would like to not have it sleep but wait for user input to advance the program (I haven't actually written it yet so I dont have any code sorry).
Lyqyd #2
Posted 06 February 2013 - 12:30 PM
Split into new topic.

You're either looking for:

print("Press any key to continue.")
os.pullEvent("key")

Or:

local input
repeat
print("Type yes to continue.")
input = read()
until string.lower(input) == "yes"

… I think. :)/>
lordxarus #3
Posted 06 February 2013 - 12:41 PM
Thank you