Using handler local variables of caller

Dar Scott dsc at swcp.com
Tue May 1 20:14:42 EDT 2012


I want to make a few commands and functions that work like some built-in functions.

For example, the built-in commands 'read' and 'ask...' both set 'it'.  If I make my own version of 'ask', I'd like for the command to set 'it'.

For example, the built-in "function" 'value()' works in the local context.  I'd like to make my own version of 'value()'.

There are ways around these problems, but I wanted to keep things simple for the user.  

Dar


On May 1, 2012, at 6:03 PM, dunbarx at aol.com wrote:

> I'm with Bob. When parameters are passed in a normal function call, they are completely local from both ends, and disappear after use. If you need to use values of some kind in order to work at all, and therefore have to extract them from somewhere, like a custom property, can you tell us why you do not want to simply use parameters in the first place?
> 
> 
> -----Original Message-----
> From: Bob Sneidar <bobs at twft.com>
> To: How to use LiveCode <use-livecode at lists.runrev.com>
> Sent: Tue, May 1, 2012 6:59 pm
> Subject: Re: Using handler local variables of caller
> 
> 
> If the handlers are in the same script, can't you use script local variables? If 
> they are in different scripts, then Peter's suggestion of using properties may 
> be the way to go. Seems like a lot to avoid passing parameters though. 
> 
> Bob
> 
> On May 1, 2012, at 3:11 PM, Dar Scott wrote:
> 
>> I'd like a function to use some variables of the caller without them being 
>> passed or being declared as globals.  Is there a way to do that?
>> 
>> Desktop externals can do that, but I don't see a way for a library in a 
>> function to do that.
>> 
>> Dar





More information about the use-livecode mailing list