For example, if I did something like this, then I run the risk of having the money duplicated if the MyBank.Save would happen to fail:
- Code: Select all
MyPlayer.Set("money", MyPlayer.GetInt("money") + MyBank.GetInt("money"));
MyPlayer.Save(delegate(){
MyBank.Set("money", 0);
MyBank.Save();
});
And if I was to switch it up and save the MyBank object first and the MyPlayer second, then I run the risk of the money being lost altogether. Generally speaking, this isn't something that normally occurs but there are rare cases that always come up over the years in which a player has had their money or items "vanish" due what I believe above occurring. This seems like a common issue that many developers probably had to tackle. Is there something I'm missing, or is it just not possible to be 100% fail-safe?