Arrays in Rev

Mark Brownell gizmotron at earthlink.net
Fri Dec 10 13:34:14 EST 2004


Hi,

I fooled around with array's and pull-parsers for an easier solution.

"Dimensional Arrays:

This thing is not a real array within an array, it just acts like one. 
It provides a way to store the data as MTML, like simple XML. This 
version is created with functions that can be copied to your own 
scripts.

Paste this into the message window:
go URL "http://www.gizmotron.org/revolution/dimensionalList.rev"

   -- see stack scripts for functions
   -- function addArray dataString, spotArray, theData
   -- Note: addArray() will replace data that already exists in the 
dataString
   -- Example for adding multi-dimensional data:
   -- put addArray(myMTMLDataString, "[1][4][5]", "John Doe") into field 
"showMTML"
   -- put addArray(myMTMLDataString, "1,4,5", "John Doe") into field 
"showMTML"

   -- see stack scripts for functions
   -- function getArray dataString, spotArray
   -- Example for getting multi-dimensional data:
   -- put getArray(myMTMLDataString, "[1][4][5]") into field "showData"
   -- put getArray(myMTMLDataString, "1,4,5") into field "showData"

An old eperiment from the past:

> put: go url "http://www.gizmotron.org/frogbreath.rev" into the message 
> window with a active internet connection.


Regarding a comment about my pull-parser used in this I have been using 
it to run my MTML browser and speed. In that browser I was using set 
the htmlText of field "offScreenField1" to thisVar and then using put 
the htmlText of field "offScreenField1" to thatVar after that. This 
turned out to be the choke point in my parser. I needed to clean up 
fragments of html that didn't have completed syntax because only a 
smaller portion of the full markup was being used in the thisVar 
variable above. Rev has the ability to correct bad html. An example of 
that would be in grabbing the front part of an anchor tag while not 
including the end tag. the htmlText function adds it in so that the 
anchor works properly.

Once I used lock screen and unlock screen my cleanup script went from 
356 ticks to 0 ticks when parsing a once considered very large 
document. So it now looks like I have my solution to fast enough 
pull-parsing.

Mark Brownell
Gizmotron Graphics




More information about the use-livecode mailing list