Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
pablogott
Level 7

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
belltown
Level 7

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 ()
https://github.com/belltown/
0 Kudos
pablogott
Level 7

Re: Type Mismatch from roAssociativeArray

That works! Thank you for your help.
0 Kudos