I am trying to create a program that uses javascript to write a simple textadventure that I can then post on my blog and run on my iphone. I have run into a problem though. I was trying to make it so that my program would save it's state into cookies using JSON to convert it into strings and then post it into a cookie but then I realised that I couldn't serialize the functions that are on my item object.
I was trying to make it so that my item would have an associative array that would contain the name of the use as the key, and the function as the value. This worked well until I tried to serialize it. I learned that I could create a JSON-like serialization for functions by storing the body into a string and using escape characters for the double quotes, but for some reason I was unable to make my cookie with the function as the string stored.
When I posted the cookie and then tried to get it back the string wasn't there. My code and the over all project are on my site if you want to look at that, though my full code including the item actions are not posted yet.