Missing properties

Geoff Canyon gcanyon at gmail.com
Mon Dec 8 17:51:39 EST 2014


On Mon, Dec 8, 2014 at 5:33 PM, Scott Rossi <scott at tactilemedia.com> wrote:

> Admittedly, the cardOwnerID function could fail if a control was located
> within a nested group that was explicitly named “card id” but. . .
>

Exactly why I did it the way I did. I do like the use of the id in
returning the name, and it occurs to me that it would be better to accept
any valid reference instead of demanding the long name or id  as my earlier
functions did, so I would revise as:

function owningStack pID
  if word -5 of the long id of pID is "stack" then return word -5 to -1
of the long id of pID else return word -2 to -1 of the long id of pID
end owningStack

For the card id:

function owningCardID pID
  if word -5 of the long id of pID is "stack" then return word -9 to -1
of the long id of pID else return word -6 to -1 of the long id of pID
end owningCardID

And for the card name:

function owningCardName pID
   return the long name of owningCardID(pID)
end owningCardName

I'm a bit sad to see the change to owningCardName -- I started with a
horribly nested if statement, and I was very proud to get it down to those
two lines before.



More information about the use-livecode mailing list