mirror of
https://github.com/1bardesign/batteries.git
synced 2024-11-10 02:31:48 +00:00
stringx.apply_template works with $snake_case_symbols
This commit is contained in:
parent
292345b953
commit
76ed4b1a02
@ -214,7 +214,7 @@ stringx.dedent = stringx.deindent
|
||||
--supports $template style values, given as a table or function
|
||||
-- ie ("hello $name"):format({name = "tom"}) == "hello tom"
|
||||
function stringx.apply_template(s, sub)
|
||||
local r = s:gsub("%$(%w+)", sub)
|
||||
local r = s:gsub("%$([%w_]+)", sub)
|
||||
return r
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user