Datagrid - GetDataForLine
bobs at twft.com
Thu Dec 8 13:29:46 EST 2011
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*
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
> end repeat
> put the uData of this stack into myVariable
> repeat for each line pLine in myVariable
> end repeat
> I've always put the cp into a variable, but am now wondering if I'm wasting time/memory.
More information about the Use-livecode