Functions (was: Re: horizontal and vertical scrolling)

Bob Sneidar bobs at twft.com
Fri Jun 17 14:24:29 EDT 2011


I finally understand what the heck "passing by reference" means and what it does and why. Thank you. 

Bob


On Jun 16, 2011, at 6:36 PM, Richard Gaskin wrote:

> Pete wrote:
> 
>> Probably worth mentioning the "@" syntax for a command handler parameter.
>> 
>> If you have a handler:
>> 
>> command foo parm1, at parm2
>> --do stuff that puts a new value into parm2
>> end foo
>> 
>> .. then you call it:
>> 
>> foo tlocal1,tlocal2
>> 
>> ... tlocal2 will contain the new value put into it after foo has processed
>> it.
>> 
>> I find this useful for things like generic text manipulation commands which,
>> eg, remove certain characters or replace them with another character, where
>> you don't care about the original value of the string you're changing.
> 
> That's an excellent reminder, Pete.
> 
> It may also be helpful with large variables to save memory, since passing by value makes a copy of the data but passing by reference works on one set of data.
> 
> --
> Richard Gaskin
> Fourth World
> LiveCode training and consulting: http://www.fourthworld.com
> Webzine for LiveCode developers: http://www.LiveCodeJournal.com
> LiveCode Journal blog: http://LiveCodejournal.com/blog.irv
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list