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

Re: Help for begginer

Thank to both of you, and sorry i didn't find the other post :oops:
0 Kudos
DLC
Visitor

Re: Help for begginer

Hello everybody, I'm back 😄
I have a strange line in the debugger console that i don't understand, and i found only two posts when i typed it in the search box, but they don't have the answer i am looking for.
My code is very simple :

Function Photo_URL(Number_Array as object) as object
print Number_Array
photo_url = []
for each n in Number_Array
url = "http://www.mywebsite.com/photo" + n + ".jpg"
print url
photo_url.Push(url)
print photo_url
end for
print photo_url
return photo_url
end Function


Number_Array is an array that i create in my Main(), it contains all the numbers between 0 and 9 included (the print Number_Array gives me the list, so i think the array is not the problem), but instead of getting an array of strings that are the urls to my photos, i have 10 urls and 11 lines of:

<bsTypedValue: Function>

10 lines for the print functions inside the loop, and one for the final array.
Does anyone knows what it means please?

Thank you.
0 Kudos
RokuJoel
Binge Watcher

Re: Help for begginer

I'm thinking you have a function or subroutine by the name of photo_url? If so, then photo_url is treated as a reference to that function instead of as an array. Also, if n is an integer you'll need to do this:

url = "http://www.mywebsite.com/photo" + n.tostr() + ".jpg"


- Joel
0 Kudos
belltown
Roku Guru

Re: Help for begginer

You either need to change the name of your function or the name or your array, as they both have the same name right now, e.g:

Change:

Function Photo_URL(Number_Array as object) as object
print Number_Array
photo_url = []
....


To:

Function Photo_URL(Number_Array as object) as object
print Number_Array
photo_url_array = []
...


And, as Joel said, use .tostr() to convert your integer to a string so you can print it.
0 Kudos
DLC
Visitor

Re: Help for begginer

Once again it works, i changed the name of my array and it works great now.
Thank you.
0 Kudos
SkipFire
Visitor

Re: Help for begginer

Yeah, you have to be careful because Brightscript can be so insensitive.
0 Kudos
DLC
Visitor

Re: Help for begginer

That's what i can see, quite disturbing :cry:
0 Kudos
SkipFire
Visitor

Re: Help for begginer

Dude, that was a joke about case sensitivity. Many languages are not case sensitive and there is nothing wrong with a language that is not case sensitive.
0 Kudos
DLC
Visitor

Re: Help for begginer

I meant the fact that he refuses to work simply because he doesn't like the name of a variable, I have never seen that before (as for my short experience in programming of course Smiley LOL )
0 Kudos
SkipFire
Visitor

Re: Help for begginer

Actually it was working perfectly based on how you coded it, just not on how you wanted it to work. Photo_URL is a Brightscript function and you tried to print it without passing variables in so it just tells you the type, that is pretty standard, C#, VB.NET, and Java all behave similarly at times (yes you can point out all the ways they don't, but these are different languages, I am just pointing out that there are SOME similarities).
0 Kudos