Skip to content

Create multiline string snippet #913

Answered by atticus-sullivan
TornaxO7 asked this question in Q&A
Discussion options

You must be logged in to vote

Mutilinetext in text-nodes is not supported (at least not that way). The strings being passed to a text-node must not contain newlines. You can pass a table of strings (without newlines) tough, between the table-elements newlines will be created.
(I guess the reason is how it works to indent all inserted lines the right amount of times)

You could (the possibilities that came to my mind)

  1. split your text up into a table of strings like t({"line1", "line2"})
  2. use the fmt feature
  3. use some manual lua magic to split the string at the newlines and put the lines into a table (string.gmatch with a pattern like ([^\n])\n (didn't test it) might be useful) and then pass the table to the text-node

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@TornaxO7
Comment options

@TornaxO7
Comment options

@atticus-sullivan
Comment options

@TornaxO7
Comment options

Answer selected by TornaxO7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants