Don't amputate numberFormat (was: affecting array keys???)

Bob Sneidar bobsneidar at iotecdigital.com
Mon Apr 24 11:06:34 EDT 2017


Well as I said, the workaround is to have a function (say formatNumber) with 2 arguments, value and format string. Because the numberFormat is getting set only for that function, you can call formatNumber() and never have to worry about resetting numberformat again. And it's not more difficult to write the line of code either. In fact less so. 

Bob S


> On Apr 22, 2017, at 15:42 , Richard Gaskin via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> With numberFormat, you first change an abstraction in the engine, then do something to a value elsewhere, and if you remembered to do it in the right order, and within a single handler, you'll get what you were looking for.
> 
> That is, unless you've forgotten that you'd set the numberFormat to some value further up in the handler for some other reason than the place you happen to be typing in now some 50 lines later, where you're seeing values that aren't what you had expected because you'd overlooked that the numberFormat setting you'd done for one thing 50 lines up is still affecting everything afterward until you reset it. (Who among us has never had that happen to them?)   :)





More information about the use-livecode mailing list