Does 'exists' work on arrays?
Peter Haworth
pete at lcsql.com
Sun Mar 15 15:41:33 EDT 2015
I've been thinking of pulling that code out and making it available as a
free utility but I can't quite figure out the best way for a user to point
it to the variable containing the array.
On Sun, Mar 15, 2015 at 12:35 PM Mike Bonner <bonnmike at gmail.com> wrote:
> Thank you! Will have to study the script, and will check out lcstackbrowser
> too.
>
> On Sun, Mar 15, 2015 at 1:21 PM, Peter Haworth <pete at lcsql.com> wrote:
>
> > lcStackBrowser has one but it only operates on custom properties not
> > variables. Search keys, delete keys, change key values, add new keys all
> > available.
> >
> > And there's always the script editor variables tab.
> >
> > On Sun, Mar 15, 2015 at 11:32 AM Peter M. Brigham <pmbrig at gmail.com>
> > wrote:
> >
> > > Not a utility, but here's a way of displaying a multilevel array so you
> > > can see its structure.
> > >
> > > -- Peter
> > >
> > > Peter M. Brigham
> > > pmbrig at gmail.com
> > > http://home.comcast.net/~pmbrig
> > >
> > > -------
> > >
> > > function displayArray @pArray, pFullData, _pDimension
> > > -- by Peter M. Brigham, pmbrig at gmail.com — freeware
> > > -- adapted from a handler by Trevor DeVore
> > > -- displays an array as an outline-style list
> > > -- most useful for multidimensional arrays, to see the structure
> > > -- if an element of the array contains more than one line,
> > > -- the first line only will be displayed (less confusing to look
> > at)
> > > -- if you want to see the full data then pass pFullData = true
> > > -- _pDimension is an internally used parameter
> > > -- pArray is referenced to avoid duplicating large arrays in memory,
> > > -- but the array is not altered by this function
> > >
> > > -- call it like this: put displayArray(tArray) into fld "peruse"
> > >
> > > -- requires makestring()
> > >
> > > if _pDimension is empty then put 0 into _pDimension
> > > if pFullData = empty then put false into pFullData
> > > put ": " into divString
> > > put the keys of pArray into theKeys
> > > if line 1 of theKeys is a number then
> > > sort theKeys numeric
> > > else
> > > sort theKeys
> > > end if
> > > repeat for each line theKey in theKeys
> > > if pArray[theKey] is an array then
> > > put makeString(space,_pDimension*3) & theKey & cr after
> theText
> > > put pArray[theKey] into theTempArray
> > > put displayArray(theTempArray, pFullData, _pDimension + 1)
> after
> > > theText
> > > else
> > > if pFullData then
> > > put makeString(space,_pDimension*3) & theKey & ":" \
> > > && pArray[theKey] & cr after theText
> > > else
> > > put pArray[theKey] into tElement
> > > put empty into tTrailer
> > > if the number of lines of tElement > 1 then
> > > put " ..." into tTrailer
> > > end if
> > > put makeString(space,_pDimension*3) & theKey & divString \
> > > & (line 1 of tElement) & tTrailer & cr after theText
> > > end if
> > > end if
> > > end repeat
> > > return theText
> > > end displayArray
> > >
> > > function makeString pChar, n
> > > -- returns a string of n characters (pChar)
> > > -- no repeat loop!
> > > -- by Peter M. Brigham, pmbrig at gmail.com — freeware
> > > -- improved by Richard Gaskin
> > > set the linedel to pChar
> > > put pChar into line n of temp
> > > return temp
> > > end makeString
> > >
> > >
> > > On Mar 15, 2015, at 2:19 PM, Mike Bonner wrote:
> > >
> > > > If you are just trying to get a handle on the structure, and how to
> > pull
> > > > out specific chunks, you can declare it global, and use the message
> box
> > > to
> > > > poke around.
> > > >
> > > > If its global, in the multiline msg box declare it too, and "put the
> > keys
> > > > of... "
> > > > Then adjust it to look at subkey contents, poking around till you
> > figure
> > > > out where things are.
> > > >
> > > > And now i'm wondering if anyone has built an array browser utility?
> > > >
> > > > On Sun, Mar 15, 2015 at 11:56 AM, Scott Rossi <
> scott at tactilemedia.com>
> > > > wrote:
> > > >
> > > >> Try: if myArray is an array
> > > >>
> > > >>
> > > >> Regards,
> > > >>
> > > >> Scott Rossi
> > > >> Creative Director
> > > >> Tactile Media, UX/UI Design
> > > >>
> > > >>
> > > >>
> > > >>
> > > >> On 3/15/15, 9:50 AM, "Graham Samuel" <livfoss at mac.com> wrote:
> > > >>
> > > >>> Still struggling with arrays: no results, no error messages, no
> > dataŠ
> > > >>> will get there no doubt. While trying to get there, I tried
> > > >>>
> > > >>> put exists(myArray[³gpx²])
> > > >>>
> > > >>> I got Œfalse¹, but the IDE seems to say that the top key in this
> > > >>> multidimensional array is ³gpx², so why isn¹t it true?
> > > >>>
> > > >>> Puzzled on a wet Sunday afternoonŠ
> > > >>>
> > > >>> Graham
> > > >>>
> > > >>>
> > > >>>
> > > >>> _______________________________________________
> > > >>> 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
> > > >>
> > > >>
> > > >>
> > > >> _______________________________________________
> > > >> 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
> > > >>
> > > > _______________________________________________
> > > > 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
> > >
> > >
> > > _______________________________________________
> > > 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
> > >
> > _______________________________________________
> > 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
> >
> _______________________________________________
> 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