- 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
推薦閱讀
- Instant Zepto.js
- Learn Scala Programming
- PySide GUI Application Development(Second Edition)
- Spring快速入門(mén)
- 區(qū)塊鏈項(xiàng)目開(kāi)發(fā)指南
- Python從入門(mén)到精通(第3版)
- Android Development Tools for Eclipse
- 監(jiān)控的藝術(shù):云原生時(shí)代的監(jiān)控框架
- Java程序設(shè)計(jì)教程
- ABAQUS6.14中文版有限元分析與實(shí)例詳解
- 交互設(shè)計(jì)師成長(zhǎng)手冊(cè):從零開(kāi)始學(xué)交互
- Modular Programming with JavaScript
- 嵌入式C編程實(shí)戰(zhàn)
- Mapping with ArcGIS Pro
- PyTorch生成對(duì)抗網(wǎng)絡(luò)編程