Difference between revisions of "Read"
From ComputerCraft Wiki
(Created the page) |
|||
| Line 2: | Line 2: | ||
|name=read | |name=read | ||
|args= [[char (type)|char]] to replace userinput with | |args= [[char (type)|char]] to replace userinput with | ||
| − | |api= | + | |api= |
|addon=ComputerCraft | |addon=ComputerCraft | ||
|desc=Lets you get input of the user. | |desc=Lets you get input of the user. | ||
Revision as of 13:12, 8 July 2012
| Lets you get input of the user. | |
| Syntax | read(char to replace userinput with) |
| Returns | nil |
| Part of | ComputerCraft |
| API | none |
Examples
| Prints what the user wrote. | |
| Code |
print (read()) |
| Output | Whatever the user wrote. |
| Ask for a Password and lets the user enter it. The letters are hidden by '*'. | |
| Code |
password = "computercraft" print ("Enter Password") input = read ("*") if (input == password) then print ("Password is correct. Access granted.") else print ("Password is incorrect. Access denied.") end |
| Output | Enter Password
******* Password is correct. Access granted. or Password is incorrect. Access denied. |