From eb546fd07b08feaf40256fd84535f399f59ea636 Mon Sep 17 00:00:00 2001 From: mrkubax10 Date: Thu, 4 Dec 2025 21:42:44 +0100 Subject: [PATCH] Replace variable parsing in guide with pattern matching --- guide.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/guide.lua b/guide.lua index e6b759d..eae49da 100644 --- a/guide.lua +++ b/guide.lua @@ -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