Subj : Re: question about javascript functions To : netscape.public.mozilla.jseng From : Béatrice Philippe Date : Wed Feb 16 2005 03:43 pm Thank you Matt, you are right !! with js_enumerate in c++, we can retrieve all parameter names of the function (parameters appear at the top of the enumeration). Now, i just need to give parameter values to my js_callFunctionValue(). I think js_convert() should be the right solution ?! Thank you again. -- Béatrice Philippe-Derbez "Matthew Mondor" a écrit dans le message de news: mailman.1108428000.27720.mozilla-jseng@mozilla.org... > On Mon, 14 Feb 2005 22:22:27 +0100 > "Béatrice Philippe" wrote: > >> Another question : is there any way to get argument names of a each >> javascript function stored in the global object ? i saw i could get >> the number of arguments but no names.... > > Hmm I just ran a little test through the js shell to see if function > arguments would be considered properties and could be iterated though: > > function test(arg1, arg2) > { > for (;;) ; > } > > for (i in test) > print(i + ' = ' + test[i] + "\n"); > > This suggests that a C function running through the properties after a > JS_Enumerate() could retreive the argument names of a function, if > working on the function JSObject... A function similar to the one I > posted above in the "Iterating through all Array elements from C" would > most probably work. Unfortunately, the JSIdArray structure is supposed > to be considered private API, according to the reference documentation I > read > (http://www.mozilla.org/js/spidermonkey/apidoc/gen/api-JSIdArray.html) > but it worked for me and I needed the functionality. > > Matt .