numberFormat affecting array keys???

Richard Gaskin ambassador at fourthworld.com
Thu Apr 20 20:04:35 EDT 2017


Bob Sneidar wrote:

 > Hi all.
 >
 > Put this into a button:
 >
 > on mouseUp
 >    set the numberFormat to "00"
 >    repeat with i=1 to 10
 >       put i into myArray [i]
 >       breakpoint
 >    end repeat
 > end mouseUp
 >
 > At the breakpoint examine the array. There will be a 1 in an element
 > with the name... ready??? "01"
 >
 > Okay THAT has GOT to be a bug!!! Why the hell is numberformat
 > modifying the name of the array element?? I haven't done ANY math on
 > it. Apparently the engine DOES!

I believe that has to do with the evaluation done in the debugger's 
variable viewer, and not in the array itself.

Why it happens I can't say, but the array itself seems fine:

If you get the keys of the array you'll see they're padded with 
preceding 0s as you'd expect.  And the same is true for the values for 
each key.

In fact, when I first tested this I added this just before the end of 
the handler:

   put myArray[2]

...and I got empty.

Then I changed that to:

   put myArray[02]

..and I got:

  02

-- 
  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