Hi Aras,
There's a NPN_GetIntIdentifier() that you can use to get an integer
identifier and with that you can access properties by index off of any
JS object, including Array's.
Aras Pranckevicius wrote:
Hi,
How can I access javascript array elements from inside npruntime?
I have javascript array passed to my plugin's function: like
plugin.MyFunction( new Array(1,2,3) );
The array argument is an variant (as expected). I can get the
length of the array by querying "length" property or by doing
NPN_Evaluate on the object with a "length" script. I get back an Int32
variant with the correct value.
However, I did not find a way to query the contents of the array yet.
Doing something like "[0]" produces null result in NPN_Evaluate and
NPN_HasProperty returns false for that (even if the docs near
NPN_GetStringIdentifier seem to imply that indexing should work).
Any suggestions?
(everything's happening on Firefox 1.5.0.6)
dev-tech-plugins mailing list
dev-tech-plugins (AT) lists (DOT) mozilla.org