Oddity in 'currentCard' function?

Mark Waddingham mark at livecode.com
Thu Oct 26 04:40:11 EDT 2023


On 2023-10-25 15:41, Craig Newman via use-livecode wrote:
> Paul.
> 
> The construction "answer this card of stack “X” does not work if you 
> are not on stack “X”:
> 
> answer the  currentCard of stack  “X”  —works
> 
> answer the name of this card of stack “X —works
> 
> answer this card of stack “X”—Nope

'this card of this stack' is an object reference - when evaluated in 
contexts which don't expect an object reference, object references 
return the *content* of the object, or an error (if the object has no 
content)... Only buttons and fields have content - in which case 
evaluating them returns the 'text' of the object.

Most things *don't* expect an object reference - places that do are 
where an object needs to be acted on, rather than a value being needed.

For example:

   set the X of <object-reference>
   put exists(<object-reference>)
   put there is an <object-reference>
   answer <string>

Warmest Regards,

Mark.

-- 
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Build Amazing Things



More information about the use-livecode mailing list