-6

I am new to lua. So what's the diference? I could not find it on the wiki.

technikfe
  • 121
  • 1
  • 8
  • 1
    There is no global function named `read`. Can you update your question to show code with examples of both? – Keith Thompson Aug 27 '16 at 19:09
  • in computercraft lua there is – technikfe Aug 27 '16 at 21:48
  • ComputerCraft has their own [forum](http://www.computercraft.info/forums2/index.php?/forum/14-ask-a-pro/) for questions. I would recommend asking questions specific to that environment there, where more people are able to answer – KingofGamesYami Aug 29 '16 at 17:53

1 Answers1

4

In ComputerCraft, io.read (IO API) (and subsequently file:read) is a slimmed down version of the io.read found in the standard Lua I/O library.

io.read: Only allows format string “*l”.

file:read: Doesn’t support format string “*n” or a character count.

read, on the other hand, allows you to get user input, while masking the characters they write. It also appears to support some kind of history, and auto completion. It has the function signature:

read([ char replacement [, table history [, function auto complete ]] ])

and returns the string that the user inputs.

In the future, their wiki has a Search function. I've actually never used ComputerCraft, but the information above wasn't exactly hard to extract.

Community
  • 1
  • 1
Oka
  • 23,367
  • 6
  • 42
  • 53