Strings

A string is any collection of characters.

It can be enclosed in single quote characters, double quote characters, or pairs of square brackets:

"Dr. John Smith" 'Radiology' [[Downtown Hospital]]

You can use dashes and square brackets to enclose multiple lines:

--[[The results of the lab tests are in. No abnormalities have been detected.]]

If you want to include brackets in a multi-line string, you can use an open bracket [ followed by one or more = characters and then another open bracket to indicate the start of a string. The string is ended by a close bracket ], the same number of = characters, and another close bracket:

[==[This string contains [] bracket characters, but is ended by a ], two = and another ].]==] [=[This string also contains [] brackets]=]

There are many operations that can be performed on strings; explore these in more depth: Common string operations.

 

Related pages