Strings
A string represents text that is defined between double quotes " ".
local greeting = "Hello World"
String Concatenation
With string concatenation multiple strings can be combined into a single string. This is done by using the + operator.
local firstName = "Lithrun"
local lastName = "Silvar"
local fullName = firstName + " " + lastName
print(fullName) // Lithrun Silvar
String Interpolation
With string interpolation values can be inserted directly instead a string instead of joining multiple strings manually. This let’s you write cleaner and simpler code.
local firstName, lastName = "Lithrun", "Silvar"
print(`Hello {firstName} {lastName}`) // Hello Aria
String Multiline
By using `` a multiline string can be defined.
local text = `
Hello World
Have a wonderful day
`
String Escaping
Within a string, some characters are reserved such as " or `. If you do want to use these within a string, then you need to prepend it with an \ escape character.
print("\"Hello World\"") // "Hello World"
Length
To get the length of a string, the # operator can be used.
local name = "Lithrun"
print(#name) // 7