I'm working on someone else's code who adds a bunch of things to an roAssociativeArray. Rather than try to go through the code and see what all gets added, I thought I'd just try to print it out. All I've done is come up with a couple of ways to reboot the Roku. My first attempt was:
x = createObject("roAssociativeArray")
x.AddReplace("key 1", "val 1")
x.AddReplace("key 2", "val 2")
x.AddReplace("key 3", "val 3")
x.AddReplace("key 4", "val 4")
y = x.Reset()
while y <> invalid
print y
y = x.Next()
end while
I didn't know what to expect from the 'print y', but it drops into the debugger with a "Non printable value" error. I wasn't too surprised, but I was surprised at what happened when I replaced the 'print y' with 'print "y"'. It prints out five y's, the telnet connection is lost and the Roku DVP reboots. My next attempt was:
x = createObject("roAssociativeArray")
x.AddReplace("key 1", "val 1")
x.AddReplace("key 2", "val 2")
x.AddReplace("key 3", "val 3")
x.AddReplace("key 4", "val 4")
y = x.Reset()
while not x.IsEmpty()
print "y"
y = x.Next()
end while
The same thing happens: 5 y's, lost telnet connection, reboot.
So I guess I have two questions. Should this cause a reboot and how do I iterate over an roAssociativeArray and print out the key/value pairs?
-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.