我试图将变量连接成一个纯文字字符串,纯粹是出于可读性目的,例如
myString = "test" myString2 = [[ first part of the string this is a " .. myString .. " string last part of the string]] print(myString2)
但这确实是输出
first part of the string this is a " .. myString .. " string last part of the string
我确信它很简单,但我已经尝试使用谷歌搜索来了解如何实现这一目标并且空白.
解决方法
双括号分隔符内的引号没有做任何事情.结束双支架的唯一方法是使用双支架:
myString2 = [[ first part of the string this is a ]] .. myString .. [[ string last part of the string]]
那会给你:
first part of the string this is a test string last part of the string