String Interpolation
String interpolation is a simple alternative syntax to concatenation.
Concatenation
local label = "meaning of life"
local data = { value = 42 }
print("The " .. label .. " is " .. data.value) -- "The meaning of life is 42"
String Interpolation
local label = "meaning of life"
local data = { value = 42 }
print($"The {label} is {data.value}") -- "The meaning of life is 42"
Try It Yourself
As you can see, you declare a string interpolated by prefixing it with the "$" symbol. Brackets can contain any expression. The result of expressions will be converted to a string as with normal concatenation, although note that Pluto supports boolean concatenation unlike Lua.