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

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');
主站蜘蛛池模板: 两当县| 阿拉善左旗| 衡山县| 龙陵县| 丹东市| 始兴县| 甘谷县| 灌南县| 项城市| 宁南县| 广平县| 正镶白旗| 清远市| 思南县| 汽车| 通许县| 衡南县| 万源市| 贵州省| 宽甸| 交口县| 伊通| 景谷| 安康市| 香河县| 宁夏| 永康市| 南阳市| 乃东县| 荔波县| 如皋市| 准格尔旗| 承德市| 横山县| 德钦县| 乐清市| 应城市| 南皮县| 泸水县| 葫芦岛市| 渭源县|