Array key paths

Monte Goulding monte at sweattechnologies.com
Tue Nov 12 17:45:53 EST 2013


On 13/11/2013, at 9:38 AM, Mark Wieder wrote:

> And the multidimensional array doesn't even have to be numerically
> indexed - the split command creates a hierarchical index for the hash:
> 
> put "hello" into tTest["abba"]["zabba"]
> put  "abba,zabba" into tPath
> split tPath by comma
> -- tPath is now
> --   [1] : "abba"
> --   [2] : "zabba"
> put tTest[tPath] --> "hello"

Ah.. yeah... I should have made that more clear in my example... it's the path that needs to be numerically indexed.

The other thing you can do is mix things up:

put "hello" into tTest[1][2]["abba"]["zabba"]
put  "abba,zabba" into tPath
split tPath by comma
put  1,2 into tRootPath
split tRootPath by comma
put tTest[tRootPath][tPath] = "hello" -- true

Cheers

--
M E R Goulding 
Software development services
Bespoke application development for vertical markets

mergExt - There's an external for that!




More information about the use-livecode mailing list