22.12.2013 Views

Roku Object Reference - imaginArt

Roku Object Reference - imaginArt

Roku Object Reference - imaginArt

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

oAssociativeArray ()<br />

An associative array (also knows as a map, dictionary or hash table) allows objects to be associated with<br />

string keys. The roAssociativeArray class implements the ifAssociativeArray interface.<br />

This object is created with no parameters:<br />

• Create<strong>Object</strong>("roAssociativeArray")<br />

The ifAssociativeArray interface provides:<br />

• AddReplace(key As String, value As <strong>Object</strong>) As Void<br />

o Add a new entry to the array associating the supplied object with the supplied string. Only one<br />

object may be associated with a string so any existing object is discarded.<br />

• Lookup(key As String) As <strong>Object</strong><br />

o Look for an object in the array associated with the specified string. If there is no object<br />

associated with the string then an object implementing ifInt containing zero is returned.<br />

• DoesExist(key As String) As Boolean<br />

o Look for an object in the array associated with the specified string. If there is no associated<br />

object then false is returned. If there is such an object then true is returned.<br />

• Delete(key As String) As Boolean<br />

o Look for an object in the array associated with the specified string. If there is such an object<br />

then it is deleted and true is returned. If not then false is returned.<br />

• Clear() As Void<br />

o Remove all objects from the associative array.<br />

Example:<br />

aa = Create<strong>Object</strong>("roAssociativeArray")<br />

aa.AddReplace("Bright", "Sign")<br />

aa.AddReplace("TMOL", 42)<br />

print aa.Lookup("TMOL")<br />

print aa.Lookup("Bright")<br />

Produces:<br />

42<br />

Sign<br />

42

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!