Subj : Re: vector as return type in java function - access in jscript? To : netscape.public.mozilla.jseng From : Ulrich Staudinger Date : Wed Jan 28 2004 09:27 am thanks for the fast response. Igor Bukanov wrote: > Ulrich Staudinger wrote: > >> hi, >> >> ---------------------- jscript: >> 10: function initialize(){ >> 11: var v=dbl.getTenMinuteCandles(10); >> 12: var c= new Packages.Candle(); >> 13: xp.sendChatMessage("uls@jabber.org", "initialize."+c.getClose()); >> 14: var value=0.0; >> 15: for(i=0;i<10;i++){ >> 16: c=v.elementAt(i); >> 17: >> 18: >> 19: value+=c.getClose(); >> 20: } >> 21: xp.sendChatMessage("uls@jabber.org", "initialize."+value); >> 22: } >> ------------- >> >> i call the jscript function from a class evaluator. 'dbl' is known to >> the interpreter, as is xp. i can instantiate the new >> Packages.Candle(). Now, whenever i try to call c.getClose(), rhino >> responds with >> 'TypeError: undefined is not a function. (; line 19)' >> >> The vector should not be empty, i know that values are returned. the >> call in line 13 works. > > > Are you sure that v contains instances of Candle? Try to add something > like java.lang.System.out.println(c + " "+typeof c+" "+c.getClass()) > after the line 16. > Added what you suggested, output in console is: 'object class Candle'. TypeError is still there. i debug printed the size of the vector as well: 428. regards, ulrich .