FANDOM


StringEdit

EssentialsEdit

A string is an array of letters, numbers, and other symbols. A string may be defined within quotes, inverted quotes, and [[ ]] (used for multi-line strings). Strings are escaped with backslashes.

SamplesEdit

Sample
The following is proof of the string type.

Source:

print(type("Hello World"))
Output:

string


Sample
The following is a list of all the ways to define a string.

Source:

local a = "Foo"
local b = 'Bar'
local c = [[Foo
Bar
Baz]]
print(type(a), type(b), type(c))
Output:

string       string       string


Sample
The following is a sample of string escapes.

Source:

local a = 'Foo\'s Bar'
print(a)
Output:

Foo's Bar


ExtraEdit

Did you know that the string metatable comes built in with the string library?

Sample
The following is a sample using the string library from within the string's metatable.

Source:

print(('Foo Bar'):sub(5))
Output:

Bar

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.