using "any line of field "x"??

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
scotttyang
Posts: 125
Joined: Sat Jan 31, 2009 12:01 am

using "any line of field "x"??

Post by scotttyang » Wed Aug 08, 2012 5:24 am

I thought this is suppose to be straight forward. for example, I have a list in a fld, and if a word is EQUAL to ANY line in this field, then I can move on, eg.

correctword = green

fld "wordlist" contains

green
green beans
green onion
green marker

the syntax is:
if correctword = any line of fld "wordlist" then do something

I was using ....if correctword is in fld "wordlist" but then all the other 4 lines with green was selected....so I thought = to any line of fld "wordlist" would work, but this did not. ANy thoughts? make sense?

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: using "any line of field "x"??

Post by shaosean » Wed Aug 08, 2012 8:42 am

The way you tried should make sense based on the English language, but in the x-talk language the any keyword means to randomly select a line..
Documentation wrote:Use the any keyword to specify a random object of a specified type, or to designate a random chunk in a chunk expression.

Your initial method was almost correct.. You first need to set the wholeMatches property to true and then check if your word is among the lines of the field..

Code: Select all

set the wholeMatches to true
if (correctword is among the lines of field "wordlist") then do something

Post Reply