enigma-dev/enigma-dev — pull request #807 by sorlok (2014-08-24 01:20:46+00:00)
Title: Reset the "default" variable for each use if "treat uninitialized variables as 0"

***NOTE***: This fix only affects games where "treat uninitialized variables as 0" is set.

Let's say you have this:
```
obj_1.myvar = 10;
show_message(string(obj_1.myvar));
```

...but there are no active instances of obj_1. On GM:S and ENIGMA, the behavior doesn't matter ---except if the variable "treat uninitialized variables as 0" is set. If so, we cannot keep any state. The message must always print "0". (This was confirmed on GM5.)

To fix that, I changed all the object access calls to reset the default like so:
```
//Previously.
return dummy_0;

//Now:
dummy_0 = var();
return dummy_0;
```

Otherwise, the dummy variable can carry state between different "default" calls.

Note that there are other possible solutions to this problem, but this seemed the easiest (and it doesn't affect games which don't use this particular flag, which most games shouldn't). If there is a solution you prefer, let me know.