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

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
主站蜘蛛池模板: 长顺县| 罗定市| 吉安市| 余姚市| 屏南县| 缙云县| 青浦区| 秦皇岛市| 大名县| 兴文县| 靖安县| 乐清市| 扶绥县| 贵溪市| 财经| 六安市| 内乡县| 墨脱县| 普宁市| 县级市| 台湾省| 襄垣县| 丘北县| 渝中区| 寿光市| 霍林郭勒市| 宁远县| 上杭县| 虎林市| 探索| 黔南| 汽车| 阜新| 勐海县| 通州市| 南投市| 红原县| 栾川县| 永城市| 台江县| 开封县|