storing associative arrays externaly

Richard Gaskin ambassador at fourthworld.com
Mon Apr 24 12:29:37 EDT 2006


Viktoras Didziulis wrote:
> Asking again :-)... I have a program that creates indexes of values stored
> in raster maps. It needs to tie array to a file on a hard drive and get the
> file updated  when the array is modified during runtime. Also when the the
> program exits it saves array contents to file so that when it is opened
> again, it would initiate an array from the file stored. Perl has sdbm and
> several other modules that can tie hash to dbm files stored externaly. How
> can this be done in Transcript?

You can use a stack file for storage, saving the array like this:

   set the customProperties of stack "MyData" to tMyArrayA

You can put them back into an array with:

   put the customProperties of stack "MyData" into tMyArrayA

And you can access elements directly in the data stack:

   get the <elementName> of stack "MyData"

You can obtain a list of element keys in the stack properties with:

   get the customKeys of stack "MyData"


For more on using stacks as data files:
<http://lists.runrev.com/pipermail/use-revolution/2002-July/006149.html>

--
  Richard Gaskin
  Managing Editor, revJournal
  _______________________________________________________
  Rev tips, tutorials and more: http://www.revJournal.com



More information about the use-livecode mailing list