Arrays in Rev
Frank D. Engel, Jr.
fde101 at fjrhome.net
Fri Dec 10 10:17:51 CST 2004
As far as records (C's struct types), there are at least two ways to do
Mathod 1. Arrays
Since array keys can be strings, you can convert something like this:
VAR myRec : RECORD x, y : INTEGER END;
x := 5;
y := 7
into something like this:
put 5 into myRec["x"]
put 7 into myRec["y"]
(Transcript's arrays are *really* cool...)
Method 2. Objects
You can also use custom properties on objects in place of fields on
records. So create a button called "myRec", then:
set the x of button "myRec" to 5
set the y of button "myRec" to 7
On Dec 10, 2004, at 1:15 AM, Jan Schenkel wrote:
> --- Gordon <gwalias-rev at yahoo.com> wrote:
>> Dear Revolutionaries
>> Can an element of a rev array be another array?
>> If not, is there any way to achieve the effect of
>> nesting arrays - OR if not, is there some way to
>> create new container types (like the structures and
>> unions typical in C and Pascal). Basically - how do
>> create complex organized containers (objects) to
>> my data?
> Hi Gordon,
> As Xavier pointed out, there are no nested arrays in
> Revolution. In addition to his suggestion to use the
> "split" and "combine" commands when needed, I'd like
> to point at the other two options : crafting array
> keys to simulate the behaviour, and using XML trees as
> a way to hierarchically store information into nodes.
> 1. Array keys
> Revolution arrays are actually associative arrays,
> which means that the keys can be any string, and you
> can use separators as much as you like. Example :
> put "01/01/2003" into \
> put tCustomerData["78,contacts,3,phone"] into \
> 2. XML trees
> If you build your tree correctly, you can get the
> content of your data using calls like :
> put "data/customers/history/date" into \
> revPutIntoXMLNode tXMLTree,tNode,"01/01/2003"
> put "data/customers/contacts/phone" into \
> put revXMLNodeContents(tXMLTree,tNode) into \
> For more information about XML and how Rev supports
> it, make sure to download the tutorial by Sarah
> Reichelt, available from the Runtime Revolution
> website at :
> Hope this helped,
> Jan Schenkel.
> "As we grow older, we grow both wiser and more foolish at the same
> time." (La Rochefoucauld)
> Do you Yahoo!?
> The all-new My Yahoo! - Get yours free!
> use-revolution mailing list
> use-revolution at lists.runrev.com
Frank D. Engel, Jr. <fde101 at fjrhome.net>
$ ln -s /usr/share/kjvbible /usr/manual
$ true | cat /usr/manual | grep "John 3:16"
John 3:16 For God so loved the world, that he gave his only begotten
Son, that whosoever believeth in him should not perish, but have
$0 Web Hosting with up to 120MB web space, 1000 MB Transfer
10 Personalized POP and Web E-mail Accounts, and much more.
Signup at www.doteasy.com
More information about the use-livecode