Lua Strings
In Lua, strings are sequences of characters used to represent text data. They are fundamental data types that can include letters, numbers, symbols, and whitespace. Strings in Lua are immutable, meaning that once a string is created, it cannot be changed. Instead, any operation that modifies a string will result in a new string being created.
Characteristics of Lua Strings
- Immutable: Strings cannot be modified in place. Any transformation results in a new string.
- UTF-8 Support: Lua strings support UTF-8 encoding, allowing the representation of a wide range of characters from different languages.
- Versatile: Strings can be utilized for a variety of purposes, including text manipulation, data formatting, and string searching.
String Methods
string.byte()
string.char()
string.dump()
string.find()
string.format()
string.gmatch()
string.gsub()
string.len()
string.lower()
string.match()
string.pack()
string.packsize()
string.rep()
string.reverse()
string.sub()
string.unpack()
string.upper()