Subj : Re: Spidermonkey problem To : netscape.public.mozilla.jseng From : Peter Wilson Date : Sat Jul 09 2005 10:48 pm Objects don't have names - so no that's not possible. The name is simply a 'reference' to that object so you can make use of it. There can be multiple references to the same object: var a,b,c a = b = c = new Color What's the 'name' of the new Color object? If you are used to languages like 'C' then think of the names as pointers to the underlying object. Hope that helps Pete -- Peter Wilson http://www.yellowhawk.co.uk --- http://www.whitebeam.org --------------- Jan Herling wrote: > Hallo, > > I would like to knonw if there is a possibility to get the name of a JS > Object. > > > Details: > > I'm using Spidermonkey in my c++ project. > I defined my own class for JavaScript with name "Color". > This class has three properties "r", "g", "b". > > So for example I have the following script: > > function foo() > { > var value = new Color(); > } > > After executing the script the constructor of the Color-Class is called: > (in my c++ code) > > JSBool TColor::JSConstructor(JSContext *cx, JSObject *obj, uintN argc, > jsval *argv, jsval *rval) > { > > > } > > Now I would like to get the name of the obj in the Script (In my example > the name would be "value". > > Is this possible? > Perhaps a function: char* JS_GetName(obj); > > Greetings > > Jan > .