Param Naming - Object by Reference Best Practices

Mike Bonner bonnmike at gmail.com
Wed May 31 23:50:20 CEST 2017


Forgot the trailing "quote" after "portal-title-bkgnd" so it would actually
be
put "graphic" & quote & "portal-title-bkgnd" & quote into pObject

On Wed, May 31, 2017 at 3:49 PM, Mike Bonner <bonnmike at gmail.com> wrote:

> try..
> put "graphic" & quote & "portal-title.bkgnd" into pObject
>
> As it is, you end up with pObject containg: graphic portal-title-bkgnd..
> Meaning portal MINUS title MINUS bkgnd (since its unquited) and the engine
> fails because its confused about what to do with it.  Quoting the name of
> the graphic lets the engine know that its just a plain old string, and no
> interpretation is necessary.
>
> On Wed, May 31, 2017 at 3:06 PM, Sannyasin Brahmanathaswami via
> use-livecode <use-livecode at lists.runrev.com> wrote:
>
>> The more libs/behaviors we use the more we are passing params that
>> reference objects
>>
>> This fails
>>
>>
>>
>> put "graphic portal-title-bkgnd" into pObject
>> setGradient pObject
>>
>> command setGradient pObject
>> local tNewGradientArray
>> # be careful when cutting and paste to and from email
>> # tabs may get replace by spaces:
>> put "from   208,-201|mirror false|quality       good|ramp
>> 0.13000,255,255,255,0" &\
>> return into tNewGradientArray
>> put "0.62001,60,11,9,212|repeat 1|to  208,-304|type    linear|via
>>  536,-201|wrap  true" \
>> after tNewGradientArray
>> split tNewGradientArray by "|" and tab
>> set the fillGradient of pObject to tNewGradientArray #breaks with error
>> here…
>> end setGradient
>>
>> but this works
>>
>> put "graphic portalTitleBkgnd" into pObject
>>
>> Why? and what is best practice where one needs to refer to objects
>>
>> via a parameter
>> via Send
>> Vis Dispatch
>>
>> etc. my code tends to waffle all over the place with methods for doing
>> this.
>>
>> One does not expect this to be improperly evaluated
>>
>> put "graphic portal-title-bkgnd" into pObject
>>
>> What do you do? And why?
>>
>> BR
>>
>>
>>
>> _______________________________________________
>> 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