I’m making a game, where you can buy different colors for your puck(a hockey game) and when I do saveLocalData(“PuckColor”, color(255,0,25)) it gives me this error, (“error: [string “–BgNew…”] 262: Can only save a string or a number or nil.”) So how can I store color() in saveLocalData?
http://codea.io/talk/discussion/5699/storing-color-data#latestlatest
^ that thread is awesome.
I already got the answer, I stored the color as a string for example,
if color = color(255,255,255) then
color = “white”
where is the save destination for saveLocalData?
Locally
Disclaimer: I actually have no idea
In all honesty though, this is the best I’ve found, but you were in this conversation @firewolf so it’s probably nothing you don’t already know
http://codea.io/talk/discussion/6639/location-where-savelocaldata-is-stored
Specifically, this quote from @TechDojo
As an update to this - I found the directory
After a quick google search I found this link.
http://pinkstone.co.uk/where-is-the-documents-directory-for-the-ios-8-simulator/
And in it this snippet of code
#if TARGET_IPHONE_SIMULATOR
// where are you?
NSLog(@"Documents Directory: %@", [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]);
#endif
Which if you add to the end of your applicationDidFinishLaunchingWithOptions function - will print out to the log the location (buried deep within ~/Library/CoreSimulator/Devices
Ultimately you'll find that the data is indeed stored within your app's Library/Preferences folder as a .plist file stored in a reverse url style name that matches your app's unique reference.
The plist file contains a single key for your App's name with a dictionary of key / value pairs for each key that you create when using saveLocataData
This probabbly isn’t anything you don’t already know, but hope it helps