From 470104fc93e59b5729dec801138e2938439114c5 Mon Sep 17 00:00:00 2001 From: Govindass Date: Tue, 26 Jan 2021 11:54:49 +0200 Subject: [PATCH] Fix set operation on {var::*} --- .../limework/rediskript/managers/RedisController.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/net/limework/rediskript/managers/RedisController.java b/src/main/java/net/limework/rediskript/managers/RedisController.java index 242d995..ca20044 100644 --- a/src/main/java/net/limework/rediskript/managers/RedisController.java +++ b/src/main/java/net/limework/rediskript/managers/RedisController.java @@ -165,7 +165,17 @@ public class RedisController extends BinaryJedisPubSub implements Runnable { // variable.change(null, (Object[]) inputValue, Changer.ChangeMode.REMOVE); break; case "SET": + String variableName = variableNames.get(i).toString(); + + //this is needed, because setting a {variable::*} causes weird behavior, like + //1st set operation is no data, 2nd has data, etc. + //if you set it to null before action, it works correctly + + if (variableName.charAt(variableName.length()-1) == '*') { + Variables.setVariable(variableName, null, null, false); + } Variables.setVariable(variableNames.get(i).toString(), inputValue, null, false); + } } }