mirror of
https://github.com/1bardesign/batteries.git
synced 2024-11-22 06:04:35 +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
|
--supports $template style values, given as a table or function
|
||||||
-- ie ("hello $name"):format({name = "tom"}) == "hello tom"
|
-- ie ("hello $name"):format({name = "tom"}) == "hello tom"
|
||||||
function stringx.apply_template(s, sub)
|
function stringx.apply_template(s, sub)
|
||||||
local r = s:gsub("%$(%w+)", sub)
|
local r = s:gsub("%$([%w_]+)", sub)
|
||||||
return r
|
return r
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user