style of addressing objects

Klaus on-rev klaus at major.on-rev.com
Wed Feb 9 06:13:39 EST 2011


Hi Tiemo,

> Hello,
> 
> lets say I have a field "f1", grouped in grp "g1" on card "c1".
> 
> I can address the field e.g.: put "foo" into fld f1
> But I could also address: put "foo" into fld f1 of grp g1
> Or: put "foo" into fld f1 of cd c1
> Or: put "foo" into fld f1 of grp g1 of cd c1 of stack s1
> And actually every object name with or without quotes

You should always use QUOTES around NAMES! 
Always! Toujours! Sempre! Siempre! Altijd! Immer! :-)

1. This is faster, since the engine does not need to check if there is a variable with that name!
2. If there IS a variable with that name, that will probably throw an error.

> What is "the correct way" of addressing, or what is a good style or what
> shouldn't you do never.
> What do the old revolutionaries say? Just curious to get more "standard
> compliant"

There is no "correct way" but just a "it depends" :-D

You can leave the "... of cd "xyz" if the objct you are addressing IS in fact on the current card
You can leave the "... of grp "xyz" if there is only ONE field with that name on the current card.

> Thanks
> 
> Tiemo

Best

Klaus


P.S.
And DITTO! :-D

--
Klaus Major
http://www.major-k.de
klaus at major.on-rev.com





More information about the Use-livecode mailing list