Save/Load a Table

@UberGoober Codea now has json.encode and json.decode which for certain uses is a very handy way of converting a table to a string and back. It takes a bit of work if the table contains Codea data types (vec, matrices, color etc), and can be unpredictable if you feed it tables that mix array and dictionary types in a single space, or ambiguous cases such as arrays that have large gaps between the numbers (which is a bad idea anyway IMO). With huge tables (a million entries) json encode/decode can be slow. If the table is, say, a single dimension array, then table.concat is fastest. But if you need a simple way to convert a deep table containing standard Lua variable types into a string, then json is very simple and handy.

@yojimbo2000, thanks for the tip. @tomxp411’s code is perfect for the case at hand, except for the comma thing, which seems like it should only take a little tweak to fix. It actually should be easy for me to see how to fix it, but unfortunately it isn’t. I’ll look into those others if he doesn’t respond.

@tomxp411 I lost the serializer code and the link seems to be broken. Any chance you could repost?