jbrave
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2010
01:31 AM
roAssociativeArray dynamic tag selection?
If I have an associative array
}
I can easily retrieve any of the array members by key:
BrightScript Debugger> print categories.key1
test
west
best
is there any way to stick "key1" into a variable like;
keyvar=key1
print categories.keyvar
so I can call a function with the key as string and get back the member associated with that key?
in the meantime I'm using an if-then like this:
if key="key1" : print categories.key1
if key="key2" : print categories.key2
if key="key3" : print categories.key3
and so on, but this presupposed that the key's are known to the current function
}
I can easily retrieve any of the array members by key:
BrightScript Debugger> print categories.key1
test
west
best
is there any way to stick "key1" into a variable like;
keyvar=key1
print categories.keyvar
so I can call a function with the key as string and get back the member associated with that key?
in the meantime I'm using an if-then like this:
if key="key1" : print categories.key1
if key="key2" : print categories.key2
if key="key3" : print categories.key3
and so on, but this presupposed that the key's are known to the current function
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
3 REPLIES 3
renojim
Community Streaming Expert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2010
02:44 AM
Re: roAssociativeArray dynamic tag selection?
You want the LookUp() ifAssociativeArray interface, as in:
-JT
print categories.LookUp("key1")or
key="key1"
print categories.LookUp(key)
-JT
Roku Community Streaming Expert
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee.
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee.
jbrave
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2010
02:47 AM
Re: roAssociativeArray dynamic tag selection?
Thanks JT.
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
TheEndless
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2010
06:55 AM
Re: roAssociativeArray dynamic tag selection?
"renojim" wrote:
You want the LookUp() ifAssociativeArray interface, as in:print categories.LookUp("key1")orkey="key1"
print categories.LookUp(key)
-JT
Or the shorter version...
categories["key1"]
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)