411 REFERENCE · Wikibooks
Lua Programming/interpolation
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
Variable names
There is no default support for automatic interpolation of variables names being used as placeholders within a string. However, interpolation can be emulated by using the [string.gsub] function:
mystring = string.gsub("Mary had a X lamb.", "X", "little")
print mystring
Literal characters
Interpolation of literal character escape sequences does occur within a string:
print "Mary had a \n lamb" -- The \n is interpreted as an escape sequence for a newline
Bold text