Initializing local properties

Richard Gaskin ambassador at
Wed Apr 15 11:14:27 EDT 2009

David Bovill wrote:

> AFAIK - there is no easy or robust way to initialise local variables? That
> is you can't do something like:
> local thisWorks = "some long complicated result"
>> local thisDoesnt = getComplicatedResult()
>> function getComplicatedResult
>>     return "some long complicated result"
>> end getComplicatedResult

There's a request for this in the RQCC:

> You could initialize things on a preopencard - but this would not allow for
> it's use when called from another stack - as in defining a custom property
> put the complicated_Result" of btn 1 of stack "Test"
> I think there is no way to do this with locals - so you have to functions or
> properties and calculate them each time for a handler? Using a global would
> be over-cluttering things.

Why are globals so unloved?

Most programming languages support them so they can be accessed 
globally.  If you need global access, why not use a global?

  Richard Gaskin
  Fourth World
  Revolution training and consulting:
  Webzine for Rev developers:

More information about the use-livecode mailing list