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

Calling a function

Once a function is declared, it can be executed by calling it. To call a function, simply type its name, followed by parentheses. For example, to read input from the console, you call io.read(). The following snippet demonstrates how to declare and call your own function:

print ('about to declare the PrintSomething function');

function PrintSomething() -- declare the function
print ('hello, world')
end

print ('the PrintSomething function is declared');
print ('calling the PrintSomething function');

PrintSomething(); -- call the function

print ('called the PrintSomething function');
主站蜘蛛池模板: 张家界市| 万荣县| 长岛县| 道真| 墨玉县| 新闻| 同心县| 石景山区| 五家渠市| 夹江县| 宝兴县| 雷州市| 苏尼特左旗| 铜鼓县| 无极县| 古蔺县| 依兰县| 通道| 阆中市| 宁夏| 富平县| 宁河县| 乡城县| 阿巴嘎旗| 长泰县| 云龙县| 长泰县| 西宁市| 汉沽区| 彩票| 平陆县| 肇源县| 安乡县| 沈丘县| 平塘县| 尉犁县| 克东县| 石城县| 铜梁县| 衡山县| 崇左市|