'send' and behaviors

Graham Samuel livfoss at mac.com
Sat Jun 2 18:28:49 EDT 2012

It says in the LC docs for the 'send' command:

> When the send command is used the stack containing the target handler temporarily becomes the defaultStack. All object references in the message are evaluated in the current context i. e. the defaultStack. Therefore references within the message that refer to "this card" or "this stack" will be referring to the card or stack where the target handler is located. 

I am relying on this: I have a line like this in a script on a particular card, say card "A" - in fact this line is in a behavior of the card:

send "doSomething" to card "B"

This works in the sense that the handler "soSomething" is executed, but if I include a line in the handler:

put "This card is" && (the short name of this card)

I get the name of the sending card (A), not the name of the target (B) - as a result the handler doesn't have its expected context and fails since references to (for example) fields on the card containing the handler script don't resolve properly. The handler is however also in a behavior, which has certainly been correctly associated with the target card.

Am I doing something wrong, or is this an LC limitation, or is it a bug?


More information about the Use-livecode mailing list