Subj : Re: Problem with JavaScript functions To : netscape.public.mozilla.jseng From : "Yuraukar" Date : Tue Sep 30 2003 01:47 pm Altough your comments are true, I don't think these issues are responsible for the effect. (In fact this part is only for testing, so be assured that I will not rely on gets). I have tried the following code: --------------------------------- std::string cmd = "function f(a)\n{\nreturn a+5;\n}\nf(6)\n"; JSScript *script; script = JS_CompileScript(cx, glob, cmd.c_str(), strlen(cmd.c_str()),NULL,1); if (script) { ok = JS_ExecuteScript(cx, glob, script, &rval); } // alternatively: ok = JS_EvaluateScript(cx, glob, cmd.c_str(), strlen(cmd.c_str()), "stdin", 1, &rval); if (ok) { str = JS_ValueToString(cx, rval); printf("script result: %s\n", JS_GetStringBytes(str)); } ------------------------------------ Where the input script is clearly correct. This still gives me "Reference error: a is undefined". Yuraukar. .