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

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)
主站蜘蛛池模板: 万年县| 乌拉特中旗| 井研县| 博罗县| 佛冈县| 长垣县| 新龙县| 松滋市| 贵溪市| 鄂伦春自治旗| 巫山县| 兴国县| 根河市| 库尔勒市| 南华县| 嘉黎县| 隆昌县| 肇东市| 班戈县| 雷州市| 赞皇县| 增城市| 都匀市| 本溪市| 察隅县| 鄂伦春自治旗| 黄大仙区| 垦利县| 嵩明县| 海兴县| 耒阳市| 子长县| 旅游| 长宁区| 淮阳县| 永川市| 肃南| 大新县| 天峻县| 石楼县| 辉南县|