Bug in "last" keyword?

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10501
Joined: Wed May 06, 2009 2:28 pm

Bug in "last" keyword?

Post by dunbarx »

I found this in the user comments in the dictionary under the keyword "last".

To paraphrase:

Make a field with exactly three lines, two words to each line. Now do this in a button:

on mouseup
set the textStyle of word 1 of the last line of fld "yourField" to "bold" --throws an error
-- set the textStyle of word 1 of line -1 of fld "yourField" to "bold" --works
--set the textStyle of word 1 of line 3 of fld "yourField" to "bold" --works
--put word 1 of the last line of fld "yourField" --works
end mouseup

A "do" construction on the offending line does not help.

Where is this not resolving? Or is it another example of the instability in that keyword, already documented (and lamented} in the dictionary?

Craig Newman
jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7423
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Bug in "last" keyword?

Post by jacque »

If you remove "the" it works: set the textstyle of word 1 of last line of fld "yourField" to "bold"

I suspect the engine is interpreting "the" as refering to a custom property. It's probably a bug though.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10501
Joined: Wed May 06, 2009 2:28 pm

Re: Bug in "last" keyword?

Post by dunbarx »

Jacque:

And I thought that HC was more forgiving with the optional use of "the", that LC was a bit more restrictive, requiring "the" in most cases in order to be happy. Now I find you cannot use it at all in some cases. Never occurred to me, being so skittish with LC syntax as opposed to good ol' HC.

Custom property? "the last"? Wherefore art thou, reserved words?

Happy New Year.

Craig
jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7423
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Bug in "last" keyword?

Post by jacque »

It's funny, I'm fastidious about "the" in most cases: "the date", "the name", "the rect". Except I can't make myself use "the cursor", I don't know why. I cringe at "set the cursor to...", it has to be "set cursor to...".

Our brains are odd. Maybe the engine is part human.

Happy gnu ear 2 u 2.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
Post Reply