Functions (was: Re: horizontal and vertical scrolling)

Richard Gaskin ambassador at fourthworld.com
Thu Jun 16 20:36:58 CDT 2011


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



More information about the use-livecode mailing list