Skip to content

String interpolation in multi-line strings #2095

@jadarve

Description

@jadarve

Hi, I'm trying to run a string interpolation in a multiline string as follows see demo:

local my_table = {
	name = "Juan"
}

print(`Hello: {my_table.name}`)
print("----------------------")

local multi_line = [[
Multiline hello: {my_table.name}
Another line...
]]

print(multi_line)

However, Luau does not recognize the {} inside of the multiline as an argument for the interpolation.

Current result:

Hello: Juan
----------------------
Multiline hello: {my_table.name}
Another line...

Expected result:

Hello: Juan
----------------------
Multiline hello: Juan
Another line...

Is there syntax for multi-line string interpolation? I tried:

[[`
multiline
`]]

but it includes the ` inside the string.

`[[
]]`

but throws an error: Error:8: Malformed string; did you forget to finish it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions