Replace variable parsing in guide with pattern matching

This commit is contained in:
mrkubax10 2025-12-04 21:42:44 +01:00
parent 6c93528d13
commit eb546fd07b

View File

@ -1193,9 +1193,10 @@ local function preprocessHypertext(content,vars)
return S(sourceString)
end)
for key,value in pairs(vars) do
content=string.gsub(content,string.format("{{%s}}",key),value)
end
-- Replace all sequences which should be treated as variables with values provided in vars
content=string.gsub(content,"{{([^{}]+)}}",function(var)
return vars[var] or "nil"
end)
return content
end