Merge pull request #4305 from SillyTavern/feat/allow-empty-setvar Allow empty values in {{setvar/setglobalvar}}

6224e20cbe1eb01ad2aa56c1f6c8068c8dc26bf2

Cohee <18619528+Cohee1207@users.noreply.github.com>

Signed
1 files changed, +2 -2Showing whitespace changes
public/scripts/variables.js+2 -2
@@ -238,7 +238,7 @@ export function resolveVariable(name, scope = null) {
238238export function getVariableMacros() {
239239 return [
240240 // Replace {{setvar::name::value}} with empty string and set the variable name to value
241241 { regex: /{{setvar::([^:]+)::([^}]+*)}}/gi, replace: (_, name, value) => { setLocalVariable(name.trim(), value); return ''; } },
242242 // Replace {{addvar::name::value}} with empty string and add value to the variable value
243243 { regex: /{{addvar::([^:]+)::([^}]+)}}/gi, replace: (_, name, value) => { addLocalVariable(name.trim(), value); return ''; } },
244244 // Replace {{incvar::name}} with empty string and increment the variable name by 1
@@ -248,7 +248,7 @@ export function getVariableMacros() {
248248 // Replace {{getvar::name}} with the value of the variable name
249249 { regex: /{{getvar::([^}]+)}}/gi, replace: (_, name) => getLocalVariable(name.trim()) },
250250 // Replace {{setglobalvar::name::value}} with empty string and set the global variable name to value
251251 { regex: /{{setglobalvar::([^:]+)::([^}]+*)}}/gi, replace: (_, name, value) => { setGlobalVariable(name.trim(), value); return ''; } },
252252 // Replace {{addglobalvar::name::value}} with empty string and add value to the global variable value
253253 { regex: /{{addglobalvar::([^:]+)::([^}]+)}}/gi, replace: (_, name, value) => { addGlobalVariable(name.trim(), value); return ''; } },
254254 // Replace {{incglobalvar::name}} with empty string and increment the global variable name by 1