I have added the global object via
Object globalObj = cx.newObject(scope);
org.mozilla.javascript.ScriptableObject.putProperty( scope, "global",
globalObj );
then i call the script code.
Object result = cx.evaluateString(scope, code, "<javascript>", 1, null);
NOTES: cx is a Context object.
PROBLEM :
i keep getting this error
TypeError: Cannot call method "charAt" of undefined (<javascript>#8)
executing code=
can anyone enlighten me as to what i am doing wrong please?
Kind Regards
Chris Wade
hey chris,
Sounds like your context finds in your scope object (walking down to
find the base) some global property...
that's why it is not registered on top level;
try this instead; if scope is your top level scope, than
scope.put("global", scope, globalObj );
should work that way..
cheers
carlos