Multiline string problem

Currently, to write multiline strings, I’m doing this:

Is there a better way of doing this?

1 Like
description = [[
enter description here
]]
2 Likes

I’d forgotten about those. However, I’m fairly certain that that would insert newlines into the description text, as well as any indentation, which is not what I want.

1 Like

You could use \n to make the string go to the next line.

local str = "hello \nworld"

print(str) --it will stack

Hope this helps!

I believe your original method is likely the best way you could go about doing this, unless you want to use a function?

local function concat(...: string): string
   return table.concat({...}, " ")
end

local sentence = concat(
    "Hello",
    "World"
)

print(sentence) --> "Hello World"
1 Like

Alright, thanks. I just wanted to make sure that I wasn’t missing something obvious :smile:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.