Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
btpoole
Channel Surfer

roList Element

Having hard time on something. I have used roRegex split to separate a long string. According to the sdk this breaks the string into a roList. Well, the sdk for roList gives example of printing elements by using simple loop thru the index. It also shows you can use list[index number] to print specific element. I have tried the following based on the sdk but get errors.

This is from sdk to use split:

r = CreateObject("roRegex", "/+", "")
r.Split(currentlocation)

So once this is done I should have a rolist called r made up of the elements from the split, which in this case is only 3 parts.
I have reference the sdk for the rolist below. I should able to loop thru the list and print all elements or use r to print a specific.


r.ResetIndex()
x= r.GetIndex()
while x <> invalid
print x
x = r.GetIndex()
end while



Now when I step thru the rolist r I get error that member function not found referencing the line
r.ResetIndex()

I am assuming I don't understand completely, can I get some guidance on this.
Thanks
0 Kudos
2 REPLIES 2
RokuMarkn
Visitor

Re: roList Element

r is an roRegex, not an roList. r.Split() returns a list, it doesn't change the roRegex into an roList. You need to do something like

list = r.Split(currentlocation)

Then you can iterate the list using your GetIndex code with "r" replaced by "list", or simply

for each x in list
print x
end for


--Mark
0 Kudos
btpoole
Channel Surfer

Re: roList Element

Thanks Markn, I was under the impression that the split created the list but I understand now.
Thanks
0 Kudos