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: 
btpoole
Level 7

Problem with function and dot operator

I am attempting to take the GetIndex value and check it's value in order to proceed. I have the following:

Function setch()as object
channelid=contentList[msg.GetIndex()]
If channelid=1
do something here
End If
End Function


I am getting an error in the debug that "Dot" operator attempted with invalid component or reference. I really don't understand exactly what this is telling me. My roListScreen works correctly up to this point where I need to evaluate what choice was made in order to proceed in the code.
Any help appreciated.
0 Kudos
2 Replies
RokuMarkn
Level 7

Re: Problem with function and dot operator

The way to approach this is to first look at the exact error message. It includes a line number that tells you which statement had the problem. Then look at that line (which will, I am sure, be the first line in the function, the assignment to channelid). Now what dot operator could have failed? Luckily there is only one dot operator in this line, msg.GetIndex(). Now look at the list of variables in the debugger and see what the value of msg is. You will find that it is invalid. Now go back to your code and try to discover why it is invalid. In this case, it is because it is undefined -- you have never mentioned the msg variable before your attempt to use the dot operator on it. Probably you meant to pass it as a function parameter.

--Mark
0 Kudos
btpoole
Level 7

Re: Problem with function and dot operator

Thanks Mark it is a function parameter.
0 Kudos