官术网_书友最值得收藏!

  • Lua Quick Start Guide
  • Gabor Szauer
  • 93字
  • 2021-08-05 10:30:38

Console input

Doing interesting things with code usually requires some kind of input from a user. Input from the console can be obtained with the io.read() function. Unlike the functions used previously, nothing goes inside the parentheses of this one. The function will read one line of input from the user when the user presses Enter. The function returns this line of text as a string, which can be stored in a variable. The following example demonstrates this:

print ("Please enter your name:")
name = io.read()
print ("Hello " .. name)
主站蜘蛛池模板: 神池县| 永川市| 崇礼县| 上蔡县| 临江市| 泽州县| 哈密市| 古蔺县| 烟台市| 丰县| 磴口县| 河间市| 宾川县| 淅川县| 阳新县| 库尔勒市| 贺州市| 教育| 元阳县| 漾濞| 勐海县| 贵南县| 吉林省| 扶风县| 岢岚县| 鄂伦春自治旗| 凤山市| 曲沃县| 石门县| 云南省| 安图县| 历史| 武威市| 永靖县| 陵川县| 五家渠市| 卓资县| 斗六市| 随州市| 佛山市| 清水河县|