[comp.sys.mac.hypercard] Arrays in HyperCard

ns@CAT.CMU.EDU.UUCP (10/30/87)

Arrays are easy when you realize that the contents of a field can be
put into a global variable and still be accessed by line and item. This
makes hopping back to a particular card (or stack, for that matter) to
get data unnecessary. You just have to init the global and save it to
a field before shutting down.

For instance:

on openStack
  global array
  put bkgnd field 1 into array
end openStack

on closeStack
  global array
  put array into bkgnd field 1
end closeStack

function getItem theLine, theItem
  global array
  return item theItem of line theLine of array
end getItem

on setItem theLine, theItem, thing
  global array
  put thing into item theItem of line theLine of array
end setItem

In Message (for example):

SetItem 6,5,"some text"

put getItem 6,5  -- returns  some text

This beats being tied to data in a field on a particular card...

--Nick