You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: mods/savedata.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,7 +48,7 @@ auto value = Mod::get()->getSavedValue<float>("my-saved-value");
48
48
auto data = Mod::get()->getSavedValue<MyCustomSaveData>("data", MyCustomSaveData { .x = 0, .y = 0 });
49
49
```
50
50
51
-
As an useful little tip, `setSavedValue` returns the previous saved value, and if there is no previous saved value, default constructs it and returns that. You can use this knowledge, and combined with the knowledge that the default constructor for `bool` is false, to write one-time info popups using a single self-contained if statement:
51
+
As a useful little tip, `setSavedValue` returns the previous saved value, and if there is no previous saved value, default constructs it and returns that. You can use this knowledge, and combined with the knowledge that the default constructor for `bool` is false, to write one-time info popups using a single self-contained if statement:
52
52
53
53
```cpp
54
54
if (!Mod::get()->setSavedValue("shown-upload-guidelines", true)) {
0 commit comments