Chris
unread,Jun 7, 2012, 6:16:18 PM6/7/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mozilla-rhino
Consider the following code:
int[] x = { 1, 2, 3, 4 };
scope.put("arr", scope, Context.toObject(x,
scope));
cx.evaluateString(scope, "arr.push(5, 6);", "test", 1, null);
This throws an array index out of bounds exception. I assume because
the array is backed by Java. However, why doesn't Rhino take care of
expanding the array for me? It would be very useful to pass Java
arrays to javascript functions that use push and not get an
exception. Is there a way to accomplish this?