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: 
EnTerr
Roku Guru

Why do CreateObject("roAssociativeArray")?

I am reading some sample code and i notice assoc.arrays commonly created as
aa = CreateObject("roAssociativeArray")
Why so complicated, why not do just
aa = { }
Seems much easier to type and i wonder if i am missing something, as to the reason why it was done (in what seems to me) more clumsy way.

Related to that, why do
aa.posterItems = CreateObject("roArray", 5, true)
and not
aa.PosterItems = [] 
, if for all practical purposes is the same?! (in both cases arrays are re-sizable; "5" is a just a hint about initial alloc, since arr.count()==0)
0 Kudos
1 REPLY 1
TheEndless
Channel Surfer

Re: Why do CreateObject("roAssociativeArray")?

Per the docs, {} and [] are shortcuts for the CreateObjects. My guess is that they were added later in the lifecycle and the examples were never updated and/or it's still present to allow for explicit declaration for those who prefer it.
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)
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.