Strange array behavior
Peter M. Brigham
pmbrig at gmail.com
Tue Dec 17 08:31:13 EST 2013
Here's a test I did:
put "one" into Arr[1]
put "two" into Arr[2]
put "three" into Arr[3]
put Arr into Arr2
put Arr into Arr3
put "Arr is an array:" && (Arr is an array) into msg
delete variable Arr2[1]
delete variable Arr2[2]
delete variable Arr2[3]
put cr & "Arr is still an array after deleting its keys:" && (Arr2 is an array) after msg
put empty into Arr3
put cr & "Arr is still an array after putting empty into it:" && (Arr3 is an array) after msg
This gives:
Arr is an array: true
Arr is still an array after deleting its keys: false
Arr is still an array after putting empty into it: false
So it appears that the array-ness disappears when you empty the array by whatever method.
-- Peter
Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig
On Dec 16, 2013, at 11:17 PM, Richard Gaskin wrote:
> In addition to deleting the keys did you also put empty into the variable?
>
> I'm no expert on those, but I think that once a var is used as an array it remains one until you do something else with it, even if it has no keys.
>
> It's kinda like a bookshelf containing boxes: even if you remove all the boxes, you still have the bookshelf.
>
> --
> Richard Gaskin
> Fourth World Systems
> Software Design and Development for Desktop, Mobile, and Web
> ____________________________________________________________
> Ambassador at FourthWorld.com http://www.FourthWorld.com
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list