string.packsize()

string.packsize (fmt) Returns the size of a string resulting from string.pack with the given format. The format string cannot have the variable-length options 's' or 'z' (see §6.4.2).

string.pack()

string.pack (fmt, v1, v2, ···) Returns a binary string containing the values v1, v2, etc. packed (that is, serialized in binary form) according to the format string fmt (see §6.4.2).

string.match()

string.match (s, pattern [, init])matchpattern§6.4.1smatchnilpatterninit

string.lower()

string.lower (s)

string.len()

string.len (s)"""a\000bc\000"

string.gsub()

string.gsub (s, pattern, repl [, n])snpattern§6.4.1replgsubgsubGlobal SUBstitution If repl is a string, then its value is used for replacement. The character % works as an escape character: any sequence in repl of the form %d, with d between 1 and 9, stands for the value of the d-th captured substring. The sequence %0 stands for the whole match. The sequence %% stands for a single %. If repl is a table, then the table is queried for every match, using the first capture as the key. If repl

string.gmatch()

string.gmatch (s, pattern)pattern§6.4.1spattern As an example, the following loop will iterate over all the words from string s, printing one per line: s = "hello world from Lua" for w in string.gmatch(s, "%a+") do print(w) end The next example collects all pairs key=value from the given string into a table: t = {} s = "from=world, to=Lua" for k, v in string.gmatch(s, "(%w+)=(%w+)") do t[k] = v end For this function, a caret '^' at the start of a pattern does not work as an anchor, as

string.format()

string.format (formatstring, ···) Returns a formatted version of its variable number of arguments following the description given in its first argument (which must be a string). The format string follows the same rules as the ISO C function sprintf. The only differences are that the options/modifiers *, h, L, l, n, and p are not supported and that there is an extra option, q. The q option formats a string between double quotes, using escape sequences when necessary to ensure that it can saf

string.find()

string.find (s, pattern [, init [, plain]]) Looks for the first match of pattern (see §6.4.1) in the string s. If it finds a match, then find returns the indices of s where this occurrence starts and ends; otherwise, it returns nil. A third, optional numeric argument init specifies where to start the search; its default value is 1 and can be negative. A value of true as a fourth, optional argument plain turns off the pattern matching facilities, so the function does a plain "find substring" o

string.dump()

string.dump (function [, strip]) Returns a string containing a binary representation (a binary chunk) of the given function, so that a later load on this string returns a copy of the function (but with new upvalues). If strip is a true value, the binary representation may not include all debug information about the function, to save space. Functions with upvalues have only their number of upvalues saved. When (re)loaded, those upvalues receive fresh instances containing nil. (You can use th