How do I load a saved array?

0 favourites
  • 3 posts
From the Asset Store
Match the similar cards with each other and free all animals!
  • Hi everyone,

    I was following the tutorial "Array for Beginners" by Ramones.

    https://www.scirra.com/tutorials/307/ar ... ers/page-3

    This tuto is old and uses Web Storage that has been replaced by Local Storage.

    I was able to save the array in the local storage but I can't load it!

    Here is what I have done:

    On saveArray Button clicked ---> LocalStorage ---> Set item "01" to animals.AsJSON

    On loadArray Button clicked ---> (Array) Animals ---> Load from JSON string "01"

    I was expecting the entry text that displays what is in your array be filled by the Array loaded?

    What should I do?

    Thank you for your help

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Local storage

    Local Storage is asynchronous. This means reading and writing data does not complete immediately. The actions only start the process of reading or writing a value, and the game continues to run in the interim. This ensures that slow or busy storage systems do not impact the performance of the game. When the read or write is complete, a trigger fires (On item get or On item set) which indicates either the value is available to read (with the ItemValue expression) or that the value was successfully written.

    For example here is a flow to read the value of the key "score":

    1.Use the action Get item "score"

    2.A moment later, On item "score" get triggers

    3.In this trigger, use the ItemValue expression to read the item

  • Thank you Korbaach, your help was useful I understood the concept. It works well!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)