diff --git a/public/scripts/variables.js b/public/scripts/variables.js index 540dffa2b..ed6e21047 100644 --- a/public/scripts/variables.js +++ b/public/scripts/variables.js @@ -96,6 +96,12 @@ export function replaceVariableMacros(input) { continue; } + // Replace {{getvar::name}} with the value of the variable name + line = line.replace(/{{getvar::([^}]+)}}/gi, (_, name) => { + name = name.trim(); + return getLocalVariable(name); + }); + // Replace {{setvar::name::value}} with empty string and set the variable name to value line = line.replace(/{{setvar::([^:]+)::([^}]+)}}/gi, (_, name, value) => { name = name.trim(); @@ -103,12 +109,6 @@ export function replaceVariableMacros(input) { return ''; }); - // Replace {{getvar::name}} with the value of the variable name - line = line.replace(/{{getvar::([^}]+)}}/gi, (_, name) => { - name = name.trim(); - return getLocalVariable(name); - }); - // Replace {{addvar::name::value}} with empty string and add value to the variable value line = line.replace(/{{addvar::([^:]+)::([^}]+)}}/gi, (_, name, value) => { name = name.trim(); @@ -116,6 +116,12 @@ export function replaceVariableMacros(input) { return ''; }); + // Replace {{getglobalvar::name}} with the value of the global variable name + line = line.replace(/{{getglobalvar::([^}]+)}}/gi, (_, name) => { + name = name.trim(); + return getGlobalVariable(name); + }); + // Replace {{setglobalvar::name::value}} with empty string and set the global variable name to value line = line.replace(/{{setglobalvar::([^:]+)::([^}]+)}}/gi, (_, name, value) => { name = name.trim(); @@ -123,12 +129,6 @@ export function replaceVariableMacros(input) { return ''; }); - // Replace {{getglobalvar::name}} with the value of the global variable name - line = line.replace(/{{getglobalvar::([^}]+)}}/gi, (_, name) => { - name = name.trim(); - return getGlobalVariable(name); - }); - // Replace {{addglobalvar::name::value}} with empty string and add value to the global variable value line = line.replace(/{{addglobalvar::([^:]+)::([^}]+)}}/gi, (_, name, value) => { name = name.trim();