Forcing a variable to evaluate as an object reference
Jim Ault
JimAultWins at yahoo.com
Tue Sep 12 11:09:22 EDT 2006
Further note about using FOR EACH
when doing multiple repeat loops *in the same handler*, do not use the same
temp variable name. I have found reusing the tempVar name is unreliable.
Note the LNN and LNN2
set the itemdel to tab
repeat for each line LNN in listRed
--no -- delete item 1 of LNN
--no -- then try to use modified LNN for some purpose
put item 2 to -1 of LNN & cr after newListRed
end repeat
delete last char of newListRed
put newListRed into listRed
repeat for each line LNN2 in listGreen
put "done" & tab & LNN2 & cr after newListGreen
end repeat
delete last char of newList Green
put newListRed into list Green
end repeat
Jim Ault
Las Vegas
On 9/11/06 11:26 PM, "iMed Edition" <info at imed-edition.net> wrote:
> David,
>
> Your post remembers me probleme I encountered related to Bugzilla Bug
> 3648. One of the solutions could be the following:
>
>> on yeschangeit
>> ...
>> repeat for each line i in field "langfields"
>
> Be aware that if you change the content of field "langfields" inside
> the repeat loop, surely you will get an unexpected value for i in the
> next loop. So best practice is to first put the content of the field
> in a variable before the repeat statement, i.e.:
>
> put field "langfields" into tLangList
> repeat for each line i in tLangList
>
>> put "field " & i into twhere
>> get the Language[glanguage] of twhere
>> put it into field i
>
> put the Language[glanguage] of fld i into fld i -- is ok
> for me now
>
>> end repeat
>> end yeschangeit
>
> so the new handler would be (and this works for me):
>
> on yeschangeit
> global glanguage
> put field "langfields" into tLangList
> repeat for each line i in tLangList
> put the Language[glanguage] of fld i into fld i -- is ok for me
> end repeat
> end yeschangeit
>
> If this does not work you can send us a sample stack and we will find
> the bug to fix.
>
> Hope this helps!
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list