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

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)
主站蜘蛛池模板: 石棉县| 浪卡子县| 秀山| 武功县| 深水埗区| 平顺县| 翁牛特旗| 昌平区| 龙里县| 剑河县| 岑溪市| 清流县| 萍乡市| 富宁县| 临夏市| 墨竹工卡县| 新河县| 郁南县| 玉门市| 石嘴山市| 天镇县| 望都县| 开阳县| 东乡县| 德清县| 麻阳| 隆尧县| 定边县| 遂溪县| 赤壁市| 庆云县| 霞浦县| 营口市| 晴隆县| 中山市| 黄骅市| 青河县| 闵行区| 临桂县| 吉木萨尔县| 沐川县|