Bug or just something you can't do ?

Bob Sneidar bobs at twft.com
Mon Oct 1 19:22:57 EDT 2012

Yes, a conditional test for an array would be necessary, as well as a loop for multiple elements of the array. It's not that hard really, and once the code is written, it will "just work", which is the whole point of writing utility handlers. It may seem ugly, but think of it from the other end. The calling program has a one liner it can call, and can pass a normal variable, or an array. Think of this also. Somewhere the code is going to have to be complicated enough to handle the situation. Better in the handler, written once, used many times, than in the calling code which may have to be rewritten for every app that needs it. 

Just my 2¢. 


On Oct 1, 2012, at 3:36 PM, Alex Tweedly wrote:

> On 01/10/2012 17:40, Bob Sneidar wrote:
>> It's my understanding that presently you cannot pass an array element by reference. You can only pass the entire array.
> Yeah - that's the whole problem I am complaining about :-)
>> Instead try passing the entire array, then checking inside your command to see if it is an array and then act accordingly.
> I can't see how to do that (without some *really* ugly code within the handler). The problem is that (in the handler) the parameter is an array passed in by reference so that it can be modified; sometimes I want to call it with an entire array, others with a sub-array (i.e. an array element which is itself an array). So the handler can't simply check whether what was passed was an array. 

More information about the Use-livecode mailing list