t = { status='up', name='Server' } s = "$name is $status, isn't it?" print(string.gsub(s, "$(%w+)", t))
Server is up, isn't it? 2
$name is $status, isn't it? 0
t = { status='up', name='Server' } s = "$name is $status, isn't it?" print(string.gsub(s, "\\$(\\w+)", t))