What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » I've been thinking...

I've been thinking...
Author: Message:
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: I've been thinking...
You might also want to make Popups an object instead of an array, like so:
Javascript code:
var Popups = {};  // empty popups container object

The reason for this is that when you assign an element on a given index, the engine will have to create empty elements for all unassigned indexes before that index. You can see this for yourself with this sample code:
Javascript code:
// Create empty array
var myArray = [];
// Set the 10th element in the array
myArray[9] = "foo";
// Now look what happens
Debug.Trace("Length="+myArray.length);
Debug.Trace("Joined="+myArray.join());
// Output:
// Length=10
// Joined=,,,,,,,,,foo

As you can see, indexes 0 to 8 have to be assigned to undefined before index 9 can be set. We don't need this at all, and when working with big index numbers such as window handles which can range from 0 to 2,147,483,647 this may turn out pretty nasty.

I could be wrong about this though, however I still find using arrays for this case inappropriate. I find it to be better practice to assign to an object property when you only need a collection of items and don't actually need a numbered list. It won't cost you in file size either, since {} takes up as much bytes as [], so why not? :P
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
03-19-2010 05:31 PM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
I've been thinking... - by whiz on 03-11-2010 at 08:26 PM
RE: I've been thinking... - by matty on 03-15-2010 at 12:54 PM
RE: I've been thinking... - by whiz on 03-17-2010 at 08:19 PM
RE: I've been thinking... - by Spunky on 03-17-2010 at 09:08 PM
RE: I've been thinking... - by whiz on 03-18-2010 at 07:04 PM
RE: I've been thinking... - by CookieRevised on 03-19-2010 at 11:29 AM
RE: I've been thinking... - by Matti on 03-19-2010 at 05:31 PM
RE: I've been thinking... - by Mnjul on 03-19-2010 at 06:38 PM
RE: I've been thinking... - by Spunky on 03-19-2010 at 06:43 PM
RE: I've been thinking... - by Mnjul on 03-19-2010 at 07:11 PM
RE: I've been thinking... - by Matti on 03-19-2010 at 07:16 PM
RE: I've been thinking... - by whiz on 03-19-2010 at 08:06 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On