New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: String interpolation #165
Conversation
Also adds a bunch of other things that was missing entirely.
Would this support inline if-expressions? eg print(`The lock combinations are: {if combo then table.concat(combo, ", ") else "unknown"}`) |
It would. Any arbitrary expressions will fly. |
I've been thinking about the delimiter syntax and was wondering about backticks vs The benefit of |
I dislike the Having a syntax that affixes a dollar sign to a string seems to imply that all string literals would work, specifically the single quote ( The benefit of having it compatible with existing syntax highlighters only makes sense if the contents of the string wouldn't have any quotes or backslashes inside of an expression, for example |
Yeah the embedded " is a good point. Backtick it is then... |
fwiw, if you want your string to span multiple lines, we could extend backticks to also work with that? I think that is a backward compatible addition? I can add this into the RFC saying that we may at some point extend backticks to work across multiple lines. |
I don't think we need to amend the RFC for the future possibility of the multi-line literals - if we decide to extend this in the future we can just make a new RFC. |
Implements the string interpolation RFC (#165). Adds the string interpolation as per the RFC. ```lua local name = "world" print(`Hello {name}!`) -- Hello world! ``` Co-authored-by: Arseny Kapoulkine <arseny.kapoulkine@gmail.com> Co-authored-by: Alexander McCord <11488393+alexmccord@users.noreply.github.com>
Rendered link.