numberFormat affecting array keys???

Bob Sneidar bobsneidar at iotecdigital.com
Fri Apr 21 10:31:09 EDT 2017


Again, the VALUE is not being converted by numberFormat, so it ISN'T the LOOP calculation that is doing it! Otherwise the VALUE would ALSO be 1! I loop is using i and it clearly contains 1 and not 01 because that is what shows up in the value. I could put it the otherway. I could say I expected the VALUE to ALSO be 1 because this is how numberFormat shoud work, and it isn't.

But I agree numberFormat should be deprecated. Time to work on that formatNumber function!

Bob S


On Apr 21, 2017, at 24:26 , Mark Waddingham via use-livecode <use-livecode at lists.runrev.com<mailto:use-livecode at lists.runrev.com>> wrote:

As others have already said, this isn't a bug - just a consequence of
the rules previously mentioned. The engine is doing this:

 repeat with i = strToNum(1) to strToNum(10)
   put i into myArray[numToStr(i)]
 end repeat

So, the value of the key is put into the array as a number but array
keys are always strings, so it is converted to a string before indexing
the array.




More information about the use-livecode mailing list