trunc(?)
dunbarx at aol.com
dunbarx at aol.com
Fri Jan 22 10:19:13 EST 2010
This came up in the forum. Someone was getting hung up with an object
reference.
Paraphrasing:
set numberformat to "#.00"
put 1 into y
add 0 to y
put foo into field ("myField & y)
Rev thought it was field "myField1.00", not field "myfield1".
I advised him to extract the integer portion only by using the offset
function. Works fine.
But I cavalierly thought that trunc would work too. It does not. Even
though the docs say that trunc returns an integer, it does not when the
numberFormat is in play:
on mouseUp
set numberformat to "#.00"
put 1 into y
add 0 to y
answer trunc(y) -- yields "1.00"
end mouseUp
Neither does the "round" function.
Same in HC, by the way.
Bug? Glitch? Newman not getting it again?
Craig Newman
More information about the use-livecode
mailing list