Hello I’m trying to have a function change a value through the State.setVar command in Javascript, but not having any luck. It runs, but the variable remains unchanged. Is it possible to do this by passing a captured temp variable? I’m guessing not as it might be just a copy of the actual variable? Thanks
setup.reduceUses = function (varCurUses) {
var newUses = State.getVar(varCurUses) - 1;
State.setVar(varCurUses, newUses);
return newUses;
};
That said, and as long as you’re using objects, it would be more straightforward to pass the object reference in and access its uses property directly. For example: