How to call a function is a Group???

Graham Samuel livfoss at blueyonder.co.uk
Mon Apr 18 09:54:31 EDT 2005


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.

Graham

------------------------------------------------------------------------ 
---
Graham Samuel / The Living Fossil Co. / UK and France



More information about the use-livecode mailing list