Moving Arrays Into and Out of Custom Property Sets
Mac OS 9 Mac OS X Windows Linux

Array variables and custom property sets have the same structure so you can use similar notation and methods to access them. Compare:
put 100 into Scores["Ken"]  -- Adding an element to an array variable
set the Scores["Ken"] of this stack to 100  -- Adding a custom property set element
So there must be some easy way to move whole arrays into and out of custom property sets, right? Right!
Suppose you want to move the tScoresA array variable (I use "t" to mean a temporary variable, and the "A" at the end tells me its an array) into a custom property set of the currently open stack called "uScoresSet". Here's the one-liner to get this to happen:
set the customProperties["uScoresSet"] of this stack to tScoresA
Easy, no? This makes a custom key (element) in the custom property set for every key (element) in the array variable. So that means that:
tScoresA["Ken"] = the uScoresSet["Ken"] of this stack
And to get that same custom property set and put it into a different array variable called tNewScoresA, I would do this:
put the customProperties["uScoresSet"] of this stack into tNewScoresA

And there you have it! Fun with custom property sets!


Posted 9/16/2007 by Ken Ray