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

[ Question ] [ Solved ] How to value = read() sleep(value)

Started by AnthonyD98™, 08 February 2013 - 08:51 AM
AnthonyD98™ #1
Posted 08 February 2013 - 09:51 AM
How would I have the user input a value and then the sleep function use that value?

write("Sleep Value > ")
value = read()
sleep(value)

Thats not going to work ^^

So how do I do it?

Thanks, AnthonyD98
LBPHacker #2
Posted 08 February 2013 - 10:09 AM
read()
returns a string - and sleep() doesn't like strings. Solution:
sleep(tonumber(value))
AnthonyD98™ #3
Posted 08 February 2013 - 10:13 AM
read()
returns a string - and sleep() doesn't like strings. Solution:
sleep(tonumber(value))

Thank you that worked!

+1