Arrays in Rev
gizmotron at earthlink.net
Sat Dec 11 11:58:54 CST 2004
On Friday, December 10, 2004, at 05:28 PM, Troy Rollins wrote:
> But... Lingo's are REAL.
> AFAICT... you are using strings... which *look* like multidimensional
> arrays, yet they would not *work* like multi-dimensional arrays. It
> looks to me more like you have a mechanism which allows *naming* and
> storing of variables in the same context as a multi-dimensional array.
> It looks like your version is basically a way to avoid coming up with
> unique names for a lot of variables... which is cool, and all, but
> that's all it is.
It's not a panacea for all. I needed to store sub level data that is
associated with other data located at the same location. Think of it as
a storage container like nodes within other elements in an XML
document. I even use it to store binary data like images that are
encoded as base64. My goal was to have a storage container that I could
use a pull-parser on to go directly to the data I needed in one quick
call without having to use Rev's XML. This is because I fully intended
to include not well formed XML in the document. This allowed me to work
with data in the original storage format and thus produce simpler
> But how do they perform the same functions? For instance with a
> multi-level nested repeat loop iterating over the contents with a real
> multi-dimensional array? Or is there some equally convoluted code to
> do that?
If you mean testing data to see if it's the correct data to be accessed
like doing a search in a Lingo list then I break up each data table row
as an XML element with the sub data of that row as other elements
within the "row" tag-set
Example row element:
<image> ... base64Encodded data of image here... </image>
What I do is use the pull-parser to create an array of <row> objects
with the map and image data inside each object as elements of their
own. To find the map for Cleveland I loop through the row array until I
find this element: "<map>Cleveland</map>." When that is found I return
the data found in that row's <image> element. This is accomplished
real fast using the offset() function to do a string search on each row
object during the loop.
> Don't get me wrong. Cool solutions I can respect. But what works for
> you (or I) as a personal solution is not necessarily something which
> is portable to others - nor is it necessarily what they want or need.
Wanting to use a pull-parser on a structured document is exactly what I
wanted. This is the same document as the storage document. So my
solution is great for my needs. I share it because a few here might
like its simplicity and find uses for it themselves. I did come from
Director to Revolution. Revolution is so cool I never looked back. I
really got sick of Director changing shockwave to such a degree that
the new shockwave plug-ins would render my third party plug-ins
inoperative unless I redeveloped my creations to work with the
shockwave changes. I can't speak for others and what their needs are.
More information about the use-livecode