Okay, I'm at a loss here. In this example, I'm trying to write a function that should increment the value passed in (through val) and update it in the calling code in val2. It dosn't seem to be passing the correct value back. Anyone know how to do this correctly - I'm very weak in the functional coding.
[[functions]]:
squiffy.Reduction=function(Value){
set("Value",get("Value")+1);
return Value;
}
squiffy.story.go("story");
[[story]]:
set("val",100);
set("val2",squiffy.Reduction(get("val")));
val2={val2}
So I got it. I was getting variables mixed up in squiffy and in pure java (or whatever you get when you indent). Turns out that you don't need to use set and get in anything in those sections - they are just pure variables.
So...
[[functions]]:
squiffy.Reduction=function(Value){
//set("Value",get("Value")+1);
return Value+get("testVar");
}
squiffy.story.go("story");
[[story]]:
set("testVar",50);
set("val",100);
set("val2",squiffy.Reduction(get("val")));
val2={val2}