string.format

string.format("%s %q", "Hello", "Lua user!")   -- string and quoted string
Hello "Lua user!"
string.sub("taaaaaaest.lua",1,-5)
taaaaaaest

gmatch

for word in string.gmatch("Hello Lua user", "%a+") do
    print(word)
end
Hello
Lua
user
  • match pattern in lua
%d matches a digit
%u matches an uppercase letter
%a: letter %s: whitespace
string.match("%*^", '%%%*%^')
%*^