- Lua Quick Start Guide
- Gabor Szauer
- 159字
- 2021-08-05 10:30:39
Defining a function
A function declaration starts with the function keyword. After the function keyword, you provide the function name. The name of the function follows the same naming rules as the name of a variable.
After the name of your function, you have to provide a list of parameters. Parameters are variable names enclosed in parentheses (). The list of parameters may be empty if a function needs no parameters, in which case only opening and closing parentheses are given—().
Once you have declared the list of parameters, you may write the body of the function. The function body is a chunk of code, so like other chunks you need to close the body with the end keyword. The following code demonstrates a simple function:
function PrintSomething()
text1 = "hello"
text2 = "world"
print (text1 .. ", " .. text2)
end
This function definition can be broken down into the following parts:

- Visual C++程序設計學習筆記
- Learning Spring 5.0
- Cocos2d-x游戲開發:手把手教你Lua語言的編程方法
- Building a RESTful Web Service with Spring
- Internet of Things with the Arduino Yún
- Python神經網絡項目實戰
- HTML5 and CSS3 Transition,Transformation,and Animation
- ADI DSP應用技術集錦
- 軟件架構:Python語言實現
- Java應用開發技術實例教程
- 西門子S7-200 SMART PLC編程從入門到實踐
- Spring Boot實戰
- C++語言程序設計
- Python入門很輕松(微課超值版)
- .NET 4.0面向對象編程漫談:應用篇