Size of array
Richard Gaskin
ambassador at fourthworld.com
Sun Nov 18 12:24:59 EST 2007
Petrides, M.D. Marian wrote:
> Speaking of arrays... Am I correct in understanding that Rev only
> supports one dimensional arrays or am I misreading the dox?
Rev currently supports associative arrays. Unlike numerically indexed
arrays, associative array keys are not restricted to integers only, and
may use just about any string within the acceptable length range (which
in Rev I believe is 64k).
Since numerals can be included in such strings, this gives you the
ability to use numeric indices with associative arrays as you would with
indexed arrays, e.g.:
get tMyArray[1]
But using strings as keys also opens up whole new worlds of indexing
convenience beyond being limited to integers only, such as storing data
by user name for example:
put "Kevin" into tCurrentUser
get tSettingsArray[tCurrentUser]
Because nearly any string can be used as a key, you can use notation
similar to what you'd expect for multi-dimensional arrays to describe
unique elements in associative arrays as well:
get tMyArray[4,4]
For more on associative arrays in general, the Wikipedia entry is a good
starting point:
<http://en.wikipedia.org/wiki/Associative_array>
For more on Rev's implementation of them, search the docs for "array" or
"associative".
--
Richard Gaskin
Managing Editor, revJournal
_______________________________________________________
Rev tips, tutorials and more: http://www.revJournal.com
More information about the use-livecode
mailing list