ItsDeltin / Overwatch-Script-To-Workshop

Converts scripts to Overwatch workshops.
209 stars 26 forks source link

Detect 'this' interruptions. #282

Open ItsDeltin opened 3 years ago

ItsDeltin commented 3 years ago
globalvar MyClass[] array = [...];

rule: 'x'
if (array.Length > 0)
{
    array[0].DoSomething();
    MinWait();
    LoopIfConditionIsTrue();
}

class MyClass
{
    public void DoSomething()
    {
        ModifyVariable(root.array, Operation.RemoveFromArray, this);
        delete this;
    }
}

Doing something like this will have unexpected results since this is the array element and that array element is being removed with the modify. This is not an issue if DoSomething is a subroutine.