Arrays

Signe Marie Sanne signe.sanne at roman.uib.no
Thu Apr 18 02:07:01 EDT 2002


Hello to Chip and all of you,

Just some small scripts to clarify for others the use of arrays 
(which I recently have tried to find out about):

on mouseUp
   put "Mia" into animals ["cat"]
   put "Baltus" into animals ["dog"]
   combine animals using cr and "="
   put animals into fld "ny"
end mouseUp

Fld "ny" now contains:
cat=Mia
dog=Baltus

You can then try out a "multidimensional" array like this:

on mouseUp
   put "Misse" into animals["cat","white",1]
   put "Tinne" into animals["cat","white",2]
   put "Vinne" into animals["cat","white",3]
  ---Or another way to do it:
#put "Misse,Tinne,Vinne" into temp
# repeat with i = 1 to number of items of temp
    # put item i of temp into animals["cat","white",i]
#  end repeat
------------------------------
   put "Monni" into animals["dog","brown",1]
   put "Tokke" into animals["dog","brown",2]
  ---Or another way to do it:
  # put "Monni,Tokke" into temp
   #repeat with i = 1 to number of items of temp
    # put item i of temp into animals["dog","brown",i]
   #end repeat
------------------------------
put "Minni" into animals["dog","white",1]
put "Tikke" into animals["dog","white",2]
   put "minni,Tikke" into temp
  ---Or another way to do it:
   #repeat with i = 1 to number of items of temp
    # put item i of temp into animals["dog","white",i]
  # end repeat
------------------
  combine animals using cr and "="
   put animals into fld "ny" --or use a variable
end mouseUp

Fld "ny" now contains:

cat,white,1=Misse
cat,white,2=Tinne
cat,white,3=Vinne
dog,brown,1=Monni
dog,brown,2=Tokke
dog,white,1=Minni
dog,white,2=Tikke

Then you can easily extract whatever data you want to extract...

Regards
Signe Marie Sanne
-- 

1. amanuensis Signe Marie Sanne      e-mail: signe.sanne at roman.uib.no
Romansk Institutt                            tel:  +47 55 58 21 27
Oysteins gt. 1
5007 Bergen         	 http://www.hf.uib.no/hfolk/mlab/default.html
Norway




More information about the use-livecode mailing list