7
我試圖將變量連接成文字字符串,純粹出於可讀性目的將變量連接成文字字符串
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
我敢肯定這件事情簡單,但我已經嘗試使用Google找到了如何實現這一點,想出了空白。
沒錯。 Lua是一種主要基於邏輯的編程語言(與許多其他編程語言一樣),因此所有運算符(例如'('和'[[''需要與該運算符相反)(在您的情況下,'' ]]')。 – cybermonkey