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: 
pablogott
Visitor

Type Mismatch from roAssociativeArray

I am getting a Type Mismatch error from roAssociativeArray, any ideas what I'm doing wrong?

Backstory:
I added "play all" functionality based off some ideas from this thread: http://forums.roku.com/viewtopic.php?f=34&t=73760 (thanks rokujoel!) and it mostly works great except when the list comes to an end. When the last video finishes, I can no longer make any selections without restarting the channel.

As far as I can tell, what's happening is from this:

  
if type(episode) <> "roAssociativeArray" then
print "invalid data passed to showVideoScreen"
return -1
endif


so I get the -1 which this function doesn't know what to do with:


function PlayAllvideos(showlist,showindex)
result=""
while true
?"show index=";showindex
result=ShowVideoScreen(showlist[showindex])
print "result=";result
if result="user cancelled playback" then
return result
end if
showindex=showindex+1
end while
end function


So I'm guessing that it's looking for the next video, which is invalid, and that ends up breaking the app. How I can make the PlayAllVideos function exit normally?
0 Kudos
2 REPLIES 2
belltown
Roku Guru

Re: Type Mismatch from roAssociativeArray

Looks like a couple of bugs in that code of Joel's that you copied.

First, return -1 should be return "" since the function it's contained in has a string as a return type.

Second, the PlayAllvideos function doesn't terminate when it's reached the end of showlist.
Change while true to while showindex < showlist.Count ()
0 Kudos
pablogott
Visitor

Re: Type Mismatch from roAssociativeArray

That works! Thank you for your help.
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.