Roblox Wiki
Advertisement
Roblox Wiki

In Lua, a string is a value type that represents a sequence of characters. String literals are declared usually by being enclosed in two quotation marks (""). The string library provides functions for manipulating string data. Alternatively, any of its functions can be called as a method of the given string.

A string can contain null characters (\0), meaning it can be used to store arbitrary binary data. string.unpack and string.pack can be used to manipulate binary strings. In members, null-terminated strings are only accepted, meaning that strings with a null character will be truncated before it. However, certain members can return a string that is not null-terminated, such as File light iconFile dark iconFile:GetBinaryContents.

Literals[]

String literals are declared by being between two quotation marks (") or apostrophes ('). A backslash followed by the letter n ("\n") will jump to a new line, while a backslash followed by the letter t ("\t") will insert a tab space at the location.

Lua also provides multiple quoting using square brackets ([[string]]). The opening brackets can also include any number of equal signs with the closing brackets having the same number of signs ([=[string]=]).

Example[]

a = "a string" --Notice how the message/string is between the quotation marks
b = 'another string'
c = [[This is
 Multiple
 Lines!
 
 And it works!!!]]

External links[]



Advertisement