- Lua Quick Start Guide
- Gabor Szauer
- 92字
- 2021-08-05 10:30:38
String coercion
String coercion is a fancy way of asking Lua to automatically convert data types to string representations of the data. For example, a string and an integer can be combined to form a new string like the following:
pi = 3.14
message = "The rounded value of pi is: " .. pi
print(message)
print("Nine: " .. 9)
String coercion also works the other way around! Adding a string that contains only numbers to a number is valid addition:
eleven = "10" + 1
print (eleven)
print (7 + "01") -- 8
推薦閱讀
- Dynamics 365 for Finance and Operations Development Cookbook(Fourth Edition)
- 深度實(shí)踐OpenStack:基于Python的OpenStack組件開發(fā)
- C/C++算法從菜鳥到達(dá)人
- FreeSWITCH 1.6 Cookbook
- Python算法從菜鳥到達(dá)人
- 焊接機(jī)器人系統(tǒng)操作、編程與維護(hù)
- Learning Concurrent Programming in Scala
- C#開發(fā)案例精粹
- 基于SpringBoot實(shí)現(xiàn):Java分布式中間件開發(fā)入門與實(shí)戰(zhàn)
- Canvas Cookbook
- Python Projects for Kids
- Python Social Media Analytics
- PHP 7 Programming Blueprints
- 信息學(xué)奧林匹克競賽初賽精講精練
- 陪孩子像搭積木一樣學(xué)編程:Python真好玩+Scratch趣味編程(全2冊)