The example below replaces field names delimited between { and } with the field content. E.g:
“This is a field with another field {name} inside”
The replaces “name” with the contents of field called “name”.
1 2 3 4 5 6 7 8 9 | -- Searches a field called "name" for fields delimited -- between { and } and replaces them with field content str = field(name) while str:match("{(.-)}") do word=str:match("{(.-)}") str = string.gsub(str, "{" .. word .. "}", field(word)); end return str |