How to call a function is a Group???

Devin Asay devin_asay at byu.edu
Mon Apr 18 15:04:25 EDT 2005


Sorry, Graham, I didn't read your post carefully enough. I wasn't aware 
you could use the 'value' function in this way until I reread your 
post. I agree that is a better way to access a function outside of the 
current message path. My original post was simply responding to a 
question (I've forgotten who posed it) about how to send a function 
call to a group. Even as I was composing that post I thought "This 
isn't really an efficient way to do this", but it works and answers the 
original question.

On Apr 18, 2005, at 7:54 AM, Graham Samuel wrote:

> Sorry that this goes back into history (all the way to last 
> Thursday!). Devin Asay <devin_asay at byu.edu> wrote:
>> On Apr 14, 2005, at 4:07 PM, Graham Samuel wrote:
>>
>>> The trouble with Devin's solution
>
> [which was: send "get initializeGroup()" to group "mygrp" ]
>
>>>  is that it doesn't actually supply
>>> the result of the function. From the RunRev docs:
>>
>> Actally, in my example, the function's result would be put into the
>> 'it' variable.
>
>> When I'd quoted the RunRev docs:
>>>
>>>> You use the value function to call a function that's in the script 
>>>> of
>>>> an object that isn't in the message path. Usually, you can only call
>>>> custom functions that are somewhere in the message path, but you can
>>>> use the value function to call any function in any object in an open
>>>> stack.
>>>>
>>>> For example, suppose you want to use a function named "myFunction"
>>>> which is defined in the script of card 1 of a stack named "My 
>>>> Stack".
>>>> The following statement can be used to call the function from any
>>>> script or from the message box:
>>>>
>>>>   get value("myFunction()",card 1 of stack "My Stack")
>>>>
>>>>   Tip:  You can use the insert script command to place the object in
>>>> the message path. In this case, you don't need to use the value
>>>> function.
>
> Well, of course Devin you're right: but it calls into question what 
> the 'value' construct is for. Maybe the difference between the two is 
> with the context that the function 'sees' - I mean, what do 'this 
> stack' and similar references within the function refer to in each 
> case? Can anyone explain this? I don't quite have time to experiment 
> at the moment.

Maybe the answer is, like a lot of things in Rev/Transcript, there are 
several ways to do the same thing. I'm actually glad to know about this 
use of 'value'. Another weapon in the arsenal, and all that.

Devin

Devin Asay
Humanities Technology and Research Support Center
Brigham Young University



More information about the use-livecode mailing list