lua string patterns code example
Example 1: lua gsub
s = string.gsub("Lua is cute", "cute", "great")
print(s) --> Lua is great
s = string.gsub("all lii", "l", "x")
print(s) --> axx xii
s = string.gsub("Lua is great", "perl", "tcl")
print(s) --> Lua is great
Example 2: Lua string
-- Strings are immutable. Immutable simply means unmodifiable or unchangeable.
a = 'this is a string'
Example 3: lua table of all characters
for i=32, 256 do
chartable[i] = utf8.char(i)
end