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

noob questions

Hi, I just got started and have a couple questions I couldn't find answers to in the docs or forum so far...

1) What does "validateParam(variable, "roAssociativeArray", "function") do exactly? I presume it confirms the variable is of type("roAssociativeArray") but I don't know how it uses the "function" argument (it doesn't seem to make a difference what is passed there)

2) Is there a line wrap character to allow you to break the source lines? I prefer to keep my source lines < 80 characters wide, so I was looking for something equivalent to the "\" line break character so I can arbitrarily format the lines.

3) I'd be interested in reading more about the "ro" and "if" relationship. The BrightScriptReferenceManual.pdf talks about "ro" classes implementing multiple "if" classes, but I couldn't find a basic explanation of what "ro" and "if" stand for, and why the app developer needs to be concerned with "if" classes. It seems the ComponentReference only documents "ro" classes, so the discussion of "if" in the former document doesn't seem relevant to the app developer. A deeper discussion or some examples may be helpful here.

I wanted to add that I'm really impressed with the developer support so far. All the hard stuff is already done by the SDK for you, the documentation is good, and the sample code is very good.

Thanks!
Jason
0 Kudos
3 REPLIES 3
destruk
Binge Watcher

Re: noob questions

1) see GeneralUtils.brs


'******************************************************
'Validate parameter is the correct type
'******************************************************
Function validateParam(param As Object, paramType As String,functionName As String, allowInvalid = false) As Boolean
if type(param) = paramType then
return true
endif

if allowInvalid = true then
if type(param) = invalid then
return true
endif
endif

print "invalid parameter of type "; type(param); " for "; paramType; " in function "; functionName
return false
End Function


That is what it does exactly.

2) It depends on the screen. If it is an roScreen or roImageCanvas, then no, line breaks don't work - you have to manually split lines. If it is the description area on a springboard or other precreated screen, then yes. Either CHR(10) or CHR(13) does a break/line feed.
0 Kudos
jlfreund
Visitor

Re: noob questions

Hi, thanks for the reply. Regarding #2, I was wondering if there is a way to arbitrarily break or insert a new line into the brs source code to improve code readability.

Jason
0 Kudos
EnTerr
Roku Guru

Re: noob questions

"jlfreund" wrote:
3) I'd be interested in reading more about the "ro" and "if" relationship. The BrightScriptReferenceManual.pdf talks about "ro" classes implementing multiple "if" classes, but I couldn't find a basic explanation of what "ro" and "if" stand for, and why the app developer needs to be concerned with "if" classes. It seems the ComponentReference only documents "ro" classes, so the discussion of "if" in the former document doesn't seem relevant to the app developer. A deeper discussion or some examples may be helpful here.

I also wondered about that and here is my understanding (some months ago i was drawing class diagrams to get an idea of the SDK): what starts with "ro" are classes, what starts with "if" are interfaces/protocols. You can instantiate only classes and a class may implement one or more interfaces. I suspect there is some material implementation of the concept but in practical terms for us those are "traits" in the documentation, i.e. "remember when we described that interface? yeah, this class has all traits from there, we won't repeat it here"
0 Kudos