Storage
App storage is where you keep the app data inside Spaces.
How to Store Data in App Storage
How to Read the App Storage Value
App Storage Example
App.onStart.Add(function(){
if(App.storage == null){
App.setStorage(JSON.stringify({count: 0}))
}
})
// // Activates function when q is pressed
App.addOnKeyDown(81,function(player){
// Updates App.storage and executes a callback function
App.getStorage(function () {
let appStorage = JSON.parse(App.storage);
appStorage.count += 1;
App.sayToAll(`count: ${appStorage.count}`)
// Uses App.setStorage to save any changes
App.setStorage(JSON.stringify(appStorage));
});
// Synchronization not guaranteed if you add a code that uses App.storage on the very next line of the App.getStorage function.
App.sayToAll(App.storage);
})Last updated
Was this helpful?