Subj : Iterating through all Array elements from C To : netscape.public.mozilla.jseng From : Matthew Mondor Date : Thu Feb 10 2005 10:41 am Using SpiderMonkey, I have a static function of a class which requires an array as a parameter. I can get the parameter, verify that it is indeed an Array... However, I seem to have trouble to iterate though all its elements, if the indexes are either non-contiguous or non-numeric at initialization: Works: fdset[0] = fd1; fdset[1] = fd2; .... Works: fdset.push(fd1); fdset.push(fd2); .... Fails: fdset[0] = fd1; fdset[2] = fd2; Fails: fdset['input'] = fd1; fdset['output'] = fd2; This is using JS_GetArrayLength(), and iterating through 0 to its returned value using JS_GetElement(). Is there another way I can use for all types of arrays to work without straying off too much of the standard API? (non-contiguous elements ones, and associative ones). Thanks, Matt .