File, variable, array, split

Toma Tasovac ttasovac at Princeton.EDU
Tue Sep 24 18:16:00 EDT 2002


As I learn from you guys, I get more and more ambitious.  Academic career is
sooooo boring in comparison to this! :)

Along the same lines of what we've been doing here with reading files into
variables or custom properties and then turning them into arrays, what if I
wanted to have two words associated with each clickedWord: i.e. If it's a
verb, I want to have the clickeWord retunr both its infinitive AND the
translation.

Arrays can have only one element and one key, as far as I get it.  Is the
only way to do this to create two files (verb + infinitive) and
(verb+translation) and then have two sets of arrays (tTranslations, and
tForms)? 

Also, if I chose to do it with custom properties -- I've read somewhere that
only one set of cutom properties can be active at a time...

I'm stuck again.

Thanks a lot for you patience with me.

Toma

On 24.09.2002 02:53, "Geoff Canyon" <gcanyon at inspiredlogic.com> wrote:

> At 6:55 AM +1000 9/24/02, David Vaughan wrote:
>>> As others have mentioned, you can import the file either into a field or a
>>> custom property. There is one caveat to that, probably a small one, but it's
>>> good to be aware: if you store the data within your app, then you're paying
>>> the price in memory used by that data twice: once to store the information,
>>> the other for the array you build from it.
>>> 
>>> It's not likely to be a big deal, as I said. If for some reason it were,
>>> chances are good that you could rewrite your code to use a custom property
>>> directly (properties are faster than fields).
>> 
>> ...and you can do it all. Custom properties can be arrays. Read in your data
>> and make the array in which you store it a custom property. Et Voilå ...
>> stored once, still using array logic and still there when you next open it,
>> or distribute it.
> 
> An excellent point, although the syntax gets a bit tricky, especially for
> someone just getting started. Using a custom property set as an array only
> incurs about a 50% performance hit, as well -- easily fast enough for this
> purpose. I edited the wiki page on properties to add some sample code to show
> how to do this. IIt's at:
> 
> <http://macitworks.com:8080/revdocs/1501>

_____________________________________
Toma Tasovac
Princeton University
Department of Comparative Literature
318 East Pyne
Princeton, NJ 08544

ttasovac at princeton.edu
ttasovac at post.harvard.edu




More information about the use-livecode mailing list