LC7 arrayEncode/Decode

Richard Gaskin ambassador at fourthworld.com
Sun May 3 17:39:23 EDT 2015


William Prothero wrote:

 > I found an oddity with arrayEncode and arrayDecode, When I saved an
 > array to a file, first using arrayEncode(myArray), wrote it out as
 >
 > put arrayEncode(myArray) into theEncodedArray
 > put theEncodedArray into URL(“binfile:”&myfile)
 >
 >  and then read it back in using
 > put URL(“binfile:”&myFile) into theEncodedArray
 > put arrayDecode(theEncodedArray) into myArray
 >
 > myArray has the first element as a blank entry. It’s not the same
 > array as I started with.
 >
 > My array looks like myArray[1][“name”], myArray[2][“name”], etc
 >
 > This seems like a bug to me. I didn’t get any satisfaction when I set
 > the storage method as text, but then again, I couldn’t find a lesson
 > where that format was specified. But, it seems like whether it’s
 > binary or not, it should still read back in and decode correctly.

It might be a bug, but like many here I do a LOT of work with arrays, 
and with so much user testing, combined with that part of the engine's 
code base being somewhat isolated, I'd double-check the recipe first 
before submitting a bug report.

Unexpected keys can sometimes arise from running split on data that's 
inconsistently formatted.

How is the array created?

-- 
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com




More information about the use-livecode mailing list