Datagrid - GetDataForLine

Pete pete at
Thu Dec 8 14:35:29 EST 2011

There may be performance issues with accessing the Cp in a repeat loop but
I don't think there is any danger of breaking things, unless you change the
contents of the cp within the repeat loop.  I've definitely run into issues
like that.  I had one instance where I deleted lines from the "in" variable
within the repeat loop - not a good idea!

On Thu, Dec 8, 2011 at 11:10 AM, Marty Knapp <martyknapp at> wrote:

> Thanks Bob,
> I did a brief test using my first form and though it seemed to work, I was
> concerned that I was doing a no-no. So Bob, how DO you know?!! Thanks for
> the prayers! (and any cheese you may have . . .)
> So I'll keep on putting the cp into a variable first.
> Marty
>> I am not sure you can even do it the way the first example allows. It is
>> my understanding that the repeat for each form creates an internal array of
>> pointers to the delimiters in the actual memory location for the variable,
>> and that is why you cannot change myVariable inside the repeat loop.
>> Changing anything about myVariable will run the risk; no the certainty of
>> moving the variable around in memory therefore invalidating the internal
>> array of pointers, returning garbled crap instead of what you expect in
>> pLine. (ask me how I know). This is also what makes repeat for each so
>> incredibly fast! myVariable only has to be evaluated once at the beginning
>> of the repeat loop.
>> By referencing the property each time, the engine would, it seems have to
>> re-evaluate the property on every iteration, breaking the rule that you
>> cannot alter the contents of the 'in' argument. But who knows? Give it a
>> try! *prays for Marty*
>> Bob
>> On Dec 8, 2011, at 10:07 AM, Marty Knapp wrote:
>>  As to my second question, I know that dealing with data in a field is
>>> slower than in a variable and I'm wondering if the same is true when it
>>> comes to custom properties?
>>> So which is better (in a read only situation):
>>> repeat for each line pLine in the uData of this stack --uData being a
>>> custom property
>>>  dostuff
>>> end repeat
>>> or
>>> put the uData of this stack into myVariable
>>> repeat for each line pLine in myVariable
>>>  dostuff
>>> end repeat
>>> I've always put the cp into a variable, but am now wondering if I'm
>>> wasting time/memory.
> ______________________________**_________________
> use-livecode mailing list
> use-livecode at
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:

Molly's Revenge <>

More information about the Use-livecode mailing list