common code patterns

Malte Pfaff-Brill revolution at derbrill.de
Fri Aug 11 12:19:29 EDT 2017


HI Alex,

> put param(1) into isLeft
> put param(2) into isTop
> etc.
> 
> This always has fewer lines (i.e. the same number of lines as the 
> "recombine" part), and removes the loop completely.
> 
But would change the way the functions are intended to be able to called.

myFunction(the loc of control 1) has one comma delimited Parameter
while
myFunction(item 1 of the loc of control 1,item 2 of the loc of control 1) has 2 parameters

Thus combining all params into a literal first and then breaking out the items of that in the desired order

> 
> 
> repeat with i=1 to paramcount()-1
>              put param(i)&"," after theValue
> end repeat
> put param(paramcount()) after theValue
> 
> Shorter, faster, and just plain tidier :-)
> 

Agreed. :-)

Cheers,

Malte





More information about the use-livecode mailing list