Back to Luau

String Interpolation

news-2023-02-02-luau-string-interpolation.md

latest1.4 KB
Original Source

String Interpolation

February 2, 2023

String interpolation is the new syntax introduced to Luau that allows you to create a string literal with expressions inside of that string literal.

In short, it’s a safer and more ergonomic alternative over string.format.

Here’s a quick example of a string interpolation:

Embedded content

String interpolation also composes well with the __tostring metamethod.

Embedded content

To find out more details about this feature, check out Luau Syntax page.

This is also the first major language feature implemented in a contribution from the open-source community. Thanks Kampfkarren!