How do I load an array saved as JSON in local storage?

Get help using Construct 2

Post » Wed Dec 09, 2015 2:18 am

Hello. I saved the contents of an array as JSON in local storage. Now, id like to load that JSON file back into the array. How do I do that?

Thanks in advance.
B
6
S
1
Posts: 18
Reputation: 386

Post » Wed Dec 09, 2015 10:16 am

After saving you array with 'set item "myArray" to array.AsJSON'. You load it after triggering the 'on item get' event.

some event -> LocalStorage| get item 'myArray'
LocalStorage| On item "myArray" get -> Array| Load from string LocalStorage.ItemValue

Now it should be loaded.
B
24
S
3
G
1
Posts: 422
Reputation: 2,107

Post » Thu Dec 10, 2015 10:59 pm

Thanks. I realized I was using a tutorial for webstorage and the syntax differs somewhat.
B
6
S
1
Posts: 18
Reputation: 386


Return to How do I....?

Who is online

Users browsing this forum: alajajm, imhotep22, jance0405, Solomon and 12 guests