themer.lua/utils/template.lua
2022-05-25 21:34:43 -03:00

16 lines
333 B
Lua

return function (template, params, pattern)
local content = string.gsub(template, pattern or "{(%w+)}", function (s)
if params[s] == nil then
expect_nil("No variable "..s)
end
if params[s] == true then
return "true"
end
if params[s] == false then
return "false"
end
return params[s]
end)
return content
end