storing associative arrays externaly

Jan Schenkel janschenkel at yahoo.com
Mon Apr 24 13:19:53 EDT 2006


--- Viktoras Didziulis <viktoras at ekoinf.net> wrote:
>  Hi!
>  
> 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?
>  
> Many thanks and best wishes
> Viktoras
>  

Hi Viktoras,

Richard gave you great advice if you're looking to
save your index as a stack ; but now I'll try and
explain how you can do it with every-day text files
and the 'combine' and 'split' commands.
I've assumed that you don't have a 'tab' character in
your text.

## Saving the array to a text file
  combine tIndexArray using return and tab
  put tIndexArray into URL("file:" & tFilePath)

## Loading the array from a text file
  put URL("file:" & tFilePath) into tIndexArray
  split tIndexArray using return and tab

Hope this helped,

Jan Schenkel.

Quartam Reports for Revolution
<http://www.quartam.com>

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the use-livecode mailing list