Activating a Function in a Different Stack

Dave dave at looktowindward.com
Tue Oct 31 07:21:54 CST 2006


Hi,

You have to be careful about using "this" as as in "this stack",  
"this card", etc.

There are a number of ways around it:

1.  Do this:

function CalledFromDiffStack

-- This refers to the stack etc. that called this one

put CalledFromThisStack into myValue
end CalledFromDiffStack


function CalledFromThisStack

-- this refers to the stack that called this function - e.g. the  
right one!

end CalledFromThisStack


2.  Use "me" instead of "this stack" etc. as in set the xxx of me to  
yyyy.


Also it's better to use the long name of this stack when calling the  
function in a different stack, don't know why, but the short name  
sometimes doesn't work.

Hope this Helps
Cheers
Dave


On 31 Oct 2006, at 01:45, Bridger Maxwell wrote:

> Wow, thanks for the great response everyone.  I tried a few and I  
> found that
> the value function works the best.  I had actually been using virtual
> properties in a few places instead of functions, but the problem  
> then was
> that I couldn't pass parameters to them.  Here is the final script:
>
>    put "Stack" && where & quote into vStack
>    put requestData && "of" && vStack into vRequest
>    try
>      put value(vRequest,vStack) into vReturn
>    end try
>
> One thing is still a little confusing though.  Calling a function  
> like "the
> short name of the current stack" return the name of the right  
> stack, but a
> request like "the mouseLoc" returns a value that is relative to the  
> stack
> that is retrieving the data, even if that stack isn't the top  
> stack.  If the
> mouseloc function is not relative to the top stack, and it is not  
> relative
> to the stack that the value is being requested from, how does it  
> decide
> which stack it is relative to and how can I know which functions  
> are funny
> like that?
> Also one odd quirk I discovered was that when nesting value  
> functions things
> get weird.  i.e
> value( (value(vRequest,vStack) ), vStack)
> "the short name of me" would return "Odyssey" when the stack name was
> "Odyssey Sensors", and  that was the only function that would come  
> close to
> working.  Not important, but very mystifying.
>
>  TTFN
>    Bridger
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list