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.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Type Mismatch from roAssociativeArray

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

I added "play all" functionality based off some ideas from this thread: (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

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

function PlayAllvideos(showlist,showindex)
while true
?"show index=";showindex
print "result=";result
if result="user cancelled playback" then
return result
end if
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
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

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.