luastring(字符串)

字符串由一对双引号或单引号来表示

string1 = "this is string1"
string2 = 'this is string2'

可以用 2 个方括号 "[[]]" 来表示"一块"字符串

html = [[
<html>
<head></head>
<body>
    <a href="http://www.runoob.com/">菜鸟教程</a>
</body>
</html>
]]

lua中两个字符串连接用..,+号在lua中仅表示相加

python中两个字符串连接用+

print('1'..'1') --输出:11
print('1'+'1') --输出:2

使用 # 来计算字符串的长度,放在字符串前面

len = "123456"
print(#len) --输出:6
原文地址:https://www.cnblogs.com/hhs1998/p/15731121.html