I actually discovered that just recreating the array wipes it out. the null didn't work unless you stepped it out. Thanks, John On 4/22/2014 8:28 PM, Doug Lee wrote: > I use it for convenience sometimes, with both arrays and collections. > The following code is approximate and not tested: > > var collection c c = new collection > var variantArray a a = new VariantArray(10) > c.a = a > a[1] = "Hello" > a[2] = "goodbye" > ; now c.a[1] and c.a[2] are set also. > > I say convenience, but also efficiency at run time: The compiler does > not allow assignment to things like c.a[1], so copying the entire > array would effectively force you to construct a duplicate in order to > put an array into a collection. > > On Tue, Apr 22, 2014 at 09:21:43PM -0500, Jim Snowbarger wrote: > Right, But, I was questioning the need to ever do that. > Why have two copies of identical data, such that modifying one copy also > results in the other copy being modified. What purpose might that serve? > > ----- Original Message ----- > From: "Doug Lee" <doug.lee@xxxxxxxxxxxxxxxx> > To: <jawsscripts@xxxxxxxxxxxxx> > Sent: Tuesday, April 22, 2014 9:03 PM > Subject: [jawsscripts] Re: How to null a global object array > > > It's done this way for efficiency reasons, as explained in FS > documentation: "assigning one array to another will result in two > variables referring to the same array. This is to avoid the very > expensive process of copying arrays." > > On Tue, Apr 22, 2014 at 08:52:04PM -0500, Jim Snowbarger wrote: > That is a strange arrangement, where arrays are pointers to data. > For arrays x and y, set x equal to y. > And, you would think you now have two copies of data which you could modify > independently. > But, if you change the value of x[1] you would find that > y[1] has also changed. > So, what would be the purpose of ever assigning one array to another? > > > > > > ----- Original Message ----- > From: "Geoff Chapman" <gch@xxxxxxxxxxxxxxxx> > To: <jawsscripts@xxxxxxxxxxxxx> > Sent: Tuesday, April 22, 2014 9:40 AM > Subject: [jawsscripts] Re: How to null a global object array > > > yeah man what a total champion our Doug is with all his hard-earned > oft-practised shared knowledge eh? > Thanks doug just so much from up here for all you know/give out so > helpfully. > total Gold! > > ----- Original Message ----- > From: "John Martyn" <johnrobertmartyn@xxxxxxxxx> > To: <jawsscripts@xxxxxxxxxxxxx> > Sent: Wednesday, April 23, 2014 12:25 AM > Subject: [jawsscripts] Re: How to null a global object array > > >> Thank you Doug. I got things working now. I'll post the tree walker >> function soon. >> John >> On 4/20/2014 9:28 AM, Doug Lee wrote: >>> If you assign anything to a global, its previous value reference is >>> cleared; so if nothing else refers to the previous contents, they go >>> away. An example: Assume we have globals gA and gB, and your TW >>> treeWalker object. Then: >>> >>> let gA = new variantArray(50) >>> let gB = gA >>> ; gB now refers to the same array as gA, with all this implies... >>> gA[1] = TW.currentElement >>> gA[2] = IEGetCurrentDocument() >>> gA[3] = "Hi there, I'm not an object." >>> ; ... code to fill other elements of gA. >>> ; gB[1] also equals TW.currentElement now, etc. >>> TW.gotoFirstChild() ; Assume this succeeds (returns True) >>> ; TW.currentElement is now changed, but gA[1] is still its original >>> value. >>> ; gB[1] is also still the original currentElement value. >>> gA = null() >>> ; gA no longer refers to the array, but gB still does. >>> ; gB[1] is still an object. >>> var object el = gB[1] >>> ; el is now the original value of TW.currentElement >>> gB = null() >>> ; The last reference to the array is gone, >>> ; so the array and all its elements go away. >>> ; But since we saved the original value of TW.currentElement in el, >>> ; it's still there as we would expect. >>> el = null() >>> ; Last reference to the original currentElement value is gone now. >>> >>> On Sun, Apr 20, 2014 at 09:15:06AM -0600, John Martyn wrote: >>> Do you have to assign null to every element in the array in a for >>> statement? Or would just assigning null work like for example >>> myArray[1,1] = ?Null >>> or >>> let c = ArrayLength(my array) >>> for i=1 to c >>> myArray[i,1] = Null >>> endFor >>> Thanks, >>> John >>> On 4/20/2014 7:45 AM, Soronel Haetir wrote: >>>> wouldn't assigning Null() do the trick? >>>> >>>> -- >>>> >>>> Globals >>>> object glbArray >>>> >>>> void >>>> Function AutoFinishEvent() >>>> glbArray = Null() >>>> EndFunction >>>> >>>> On 4/19/14, John Martyn <johnrobertmartyn@xxxxxxxxx> wrote: >>>>> I've done functions and scripts with temporary arrays, but never a >>>>> global array. How do you clear the the array to null? >>>>> I am creating an object walker and I need to store the objects in the >>>>> array. When I'm done, I'll post the functions for tabbing and shift >>>>> tabbing. >>>>> Thanks, >>>>> John >>>>> __________??? >>>>> >>>>> View the list's information and change your settings at >>>>> //www.freelists.org/list/jawsscripts >>>>> >>>>> >>> __________??? >>> >>> View the list's information and change your settings at >>> //www.freelists.org/list/jawsscripts >>> >> __________??? >> >> View the list's information and change your settings at >> //www.freelists.org/list/jawsscripts >> > __________??? > > View the list's information and change your settings at > //www.freelists.org/list/jawsscripts > > > > __________??? > > View the list's information and change your settings at > //www.freelists.org/list/jawsscripts > __________� View the list's information and change your settings at //www.freelists.org/list/jawsscripts