Komag
6 years agoRoku Guru
Bug with nested FOR EACH blocks, internal counter gets messed up
I got some strange behavior of endless repeating, and I found out that it was due to two FOR EACH loops running (in different Functions)
The first Function runs a FOR EACH, and one of the operations inside calls another Function which calls another Function which has it's own FOR EACH that is pointing to the same list as the original FOR EACH is.
My solution was to change one of them to FOR i = 0 TO... format
Is this a known behavior that I should have been smart enough to avoid in the first place?
EDIT - I tested using FOR i = 0 TO in both FOR loops, and there is no problem, even with each using the same variable "i", so it's only when using FOR EACH and thus it uses Roku's internal counter system somehow.
The first Function runs a FOR EACH, and one of the operations inside calls another Function which calls another Function which has it's own FOR EACH that is pointing to the same list as the original FOR EACH is.
My solution was to change one of them to FOR i = 0 TO... format
Is this a known behavior that I should have been smart enough to avoid in the first place?
EDIT - I tested using FOR i = 0 TO in both FOR loops, and there is no problem, even with each using the same variable "i", so it's only when using FOR EACH and thus it uses Roku's internal counter system somehow.