Multi-dimensional arrays, tutorial?

Björnke von Gierke bvg at mac.com
Tue Aug 10 10:48:49 CDT 2010


Yes, you're right because what you're doing is not multidimensional arrays at all. You're simply using custom property sets and want to store stuff in them. I did once make an enhancement requests that ask for making arrays and properties (custom or not) basically be the same, which might that then be possible.

I think that the person who made custompropertysets had single dimension arrays in mind, but never came to the idea to just actually _make_ em arrays. Which is hugely confusing, especially considering how abstract all that subgrouping with weird brackets is to begin with.

So what you can do is either:

a. save your array in a customproperty:
set the dinnerNames of this stack to myDinnerArray

b. save your array in a custompropertyset's customproperty:
set the dinner["names"] of this stack to myDinnerArray
--equivalent of:
set the custompropertyset of this stack to "dinner"
set the names of this stack to myDinnerArray
set the custompropertyset of this stack to ""

c. do not use arrays:
set the dinner["name1"] of this stack to "tex"

d. do not use customproperties
put arrayencode(myDinnerArray) into url ("binfile:" & "Array.txt") 

Bjoernke

PS: 
Mentioned feature request: 
http://quality.runrev.com/qacenter/show_bug.cgi?id=6912


On 10 Aug 2010, at 17:24, FlexibleLearning wrote:

> If I have understood the system, then
> 
> 1. set the dinnerNames["mains"] of this stack to "tex" - good
> 2. set the dinnerNames["mains"]["spicy"] of this stack to "tex" - bad!
> 
> because
> 
> [1] is a single dimension array property
> [2] is a multi-dimensional array variable
> 
> but
> 
> [3] we can 'set' a single dimension property to a multi-dimensional array
> which is what I need to do.




More information about the use-livecode mailing list