What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Question about "MyStatus"

Question about "MyStatus"
Author: Message:
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
31 / Male / Flag
Joined: Apr 2004
RE: Question about "MyStatus"
quote:
Originally posted by CookieRevised
quote:
Originally posted by roflmao456
@cookie: that enumeration for status code you posted returns undefined if like variable[MyStatus]. using it like variable.STATUS_ONLINE will work, however.
blame matty, he posted it, not me ;)

Ah yes, you can't use the value of a variable or expression as identifier for a property when you're defining an object literal. "STATUS_ONLINE" is interpreted as a string identifier for the property, it does not take the value of STATUS_ONLINE to use as identifier.

Here are some example snippets, for those interested in what went wrong here:
Javascript code:
var key = "123";
var obj = {
    key : "abc"
};
// obj.key or obj["key"] equals "abc"
// obj[key] is undefined
 
var obj = {
    "key" : "abc"
};
// same object as above
 
var i = 0;
var obj = {
    (i++) : "first",
    (i++) : "second"
};
// gives a syntax error
// property identifier must be a constant number or string
 
var i = 0;
var obj = {};
obj[i++] = "first";
obj[i++] = "second";
// this will work though, the square brackets can take both constant or variable values

Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
01-20-2010 12:27 PM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Question about "MyStatus" - by 5n4k3 on 01-17-2010 at 06:01 PM
RE: Question about "MyStatus" - by stoshrocket on 01-17-2010 at 06:29 PM
RE: Question about "MyStatus" - by 5n4k3 on 01-17-2010 at 07:24 PM
RE: Question about "MyStatus" - by Matti on 01-17-2010 at 07:56 PM
RE: Question about "MyStatus" - by stoshrocket on 01-17-2010 at 08:10 PM
RE: Question about "MyStatus" - by 5n4k3 on 01-17-2010 at 08:24 PM
RE: Question about "MyStatus" - by CookieRevised on 01-17-2010 at 10:26 PM
RE: Question about "MyStatus" - by 5n4k3 on 01-19-2010 at 08:19 AM
RE: Question about "MyStatus" - by stoshrocket on 01-19-2010 at 02:55 PM
RE: Question about "MyStatus" - by matty on 01-19-2010 at 03:29 PM
RE: Question about "MyStatus" - by Matti on 01-19-2010 at 04:55 PM
RE: Question about "MyStatus" - by 5n4k3 on 01-19-2010 at 05:20 PM
RE: Question about "MyStatus" - by stoshrocket on 01-19-2010 at 07:52 PM
RE: Question about "MyStatus" - by CookieRevised on 01-19-2010 at 08:35 PM
RE: Question about "MyStatus" - by roflmao456 on 01-19-2010 at 10:58 PM
RE: Question about "MyStatus" - by CookieRevised on 01-19-2010 at 11:39 PM
RE: Question about "MyStatus" - by roflmao456 on 01-20-2010 at 02:47 AM
RE: Question about "MyStatus" - by 5n4k3 on 01-20-2010 at 11:20 AM
RE: Question about "MyStatus" - by Matti on 01-20-2010 at 12:27 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