So I need to pass a variable by reference and I’m using Javascript.
From this answer I learned that I need to do it in C# if I want it to work in Javascript.
Now the tricky part for me is that I never used C#.
So my attempt was to write the following function in C#:
public bool SelectedBoolean (ref bool selectedVariable){
return selectedVariable;
}
And I would like to use it in this Javascript function:
function AddStep (currentScript : List.<ScriptStep>, selectedBoolean : boolean, result : boolean){
var step = new ScriptStep (currentScript, allScriptsList);
step.stepType = StepType.BooleanChange;
step.stepSelectedBoolean = addBoolean.SelectedBoolean (out selectedBoolean : boolean);
step.stepSelectedBooleanResult = result;
currentScript.Add(step);
}
Trying to use the out is just giving me errors and no idea how I could fix it.
Also I realized that since the “selectedBoolean” is going through a Javascript function I guess it becomes a value automatically?
Does that mean I need to write the final function in C#?
How would I go about solving this?
Thanks in advance!