Thursday 25 August 2011

Saving and loading with the editor

I've had one hell of a time updating the editor, most of all with the saving and loading part of it.

Saving was fairly simple. It just exports an array (in a dynamic text box) which you can then copy and paste anywhere. However, the loading wasn't as simple. When I came up to it, I realised that I didn't actually know how to take data from an input text field and turn it into an array. After a quick Google, I decided on using the ".split();" method. Basically, it divides a string (for instance, a sentence) into letters. This was perfect for the loader, as it just split up the inputted data into readable chunks.

However, the next problem was much worse. I realised after discovering some bugs that the ".split();" method turned all of my number values into text values, which meant I couldn't put in a much needed "+1", as it just came out as "31" (that is the number gained from the .split(); method (3) and the +1).

I eventually found a solution by reworking some stuff, but God. Gave me a headache.

No comments:

Post a Comment