How can I get an input from user in Lua (like scanf
in C)?
For example, the program ask user his name, then he writes his name, then the program will output his name.
相关问题
- How to get the return code of a shell script in lu
- Jasper: error opening input stream from url
- is it normal for image inputs to be omitted from t
- How do I discard user input delivered during sleep
- How to make CSS input range thumb not appear at fi
相关文章
- 放在input的text下文本一直出现一个/(即使还没输入任何值)是什么情况
- Show a different value from an input that what wil
- Is there a way to hide the new HTML5 spinbox contr
- Programmatically interrupting raw_input
- Bootstrap input field inside tooltip popover remov
- ValueError: too many values to unpack (expected 2)
- customising the look of f.file.field in rails
- Handle IE 9 & 10's clear button with Knockout
Use io.read() Beware that the function can be customised with different parameters. Here are some examples.
The simplest input can be retrieved using
io.read()
. This will read a single line from the standard input (usually the keyboard, but can be redirected e.g. from file).You can use it like this:
io.read()
is just a shortcut forio.input():read()
, similarlyio.write()
is a shortcut toio.output():write()
. See the API forread()
here.Notice that
io.write()
will not auto-terminate your line likeprint()
does.