A string is text data. Any characters may appear in a string, though some will need to be defined via escape codes. Strings may be of any length, limited only by script memory, though there are functions which will truncate strings if they exceed a certain length. Strings may be joined using the + operator. There is no way to control the font, size, weight or color of the text, with the exception of floating text. String literals are always defined between double quotes.
string silly = "Hello, world!"; string confirm = "Yes"; string jointext = "Help " + "me"; string pi_text = "3.14159"; // this is not a floating-point value; it is a sequence of characters to be displayed. However, it could be cast to a float
- Escape codes are needed in order to display certain characters. For example, because double quotes are used to delimit strings, displaying them requires an escape sequence. These escape sequences begin with a backslash character (\).
\" double quote \t tab note that this does NOT generate a tab character; it generates four (4) whitespace characters. \n new line \\ backslash used to display a backslash character
- LSL has a number of powerful string commands and there are several more user-created functions available.