numberFormat affecting array keys???
jonathandlynch at gmail.com
jonathandlynch at gmail.com
Thu Apr 20 20:19:18 EDT 2017
I would have thought that A[1] and A[01] would be the same, while A["1"] and A["01"] were different - good to know that is not the case.
Sent from my iPhone
> On Apr 20, 2017, at 8:04 PM, Richard Gaskin via use-livecode <use-livecode at lists.runrev.com> wrote:
>
> 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
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list