Passing parameters by reference
dick.kriesel at mail.com
Mon Mar 12 15:18:47 CDT 2012
On Mar 12, 2012, at 10:19 AM, Pete wrote:
> I'm wondering how you found about about this key values array feature? I
> can't find any mention of it in the dictionary or the reference manual and
> it sure seems like something that should be known!
I found it while looking through bug reports for arrays, in <http://quality.runrev.com/show_bug.cgi?id=7166> dated 2008-11-28. So, thanks be to Mark Waddingham and David Bovill for that.
For convenience, here's Mark's reply to David:
Thanks for the suggestion.
This is on the list to include for the next version. In that version with:
put tValue into tArray[tKey]
(indeed anywhere you can currently do tArray[tKey])
The meaning of 'tKey' will be extended:
1) If it is a string then it is as it is now
2) If it is a numerically keyed array starting at 1, then it will mean:
put tValue into tArray[tKey][tKey]...[tKey[n]]
where <n> is the number of elements in tKey
3) Otherwise it is an error.
This will allow you to construct an array containing the path to the key you
want to modify/fetch/delete dynamically.
I agree, the feature's worth adding into the dictionary and manual.
More information about the use-livecode