Licensed under the Academic Free License 1.2 http://www.opensource.org/licenses/academic.php
|Object||bu_eval (String str)|
|Evaluate the argument in global scope. |
Evaluate the argument in global scope.
If you just inline a call to native
Note that Moz eval() supports a non-standard second scope parameter that could be used to achieve the same thing.
A word about ECMAScript eval(): Until JS1.4, eval is semantically a method on every object, so eval(str) meant this.eval(str). Starting in JS1.4, eval is only a top-level function. Apparently, Mozilla's deprecated window . eval forces a global context, while IE treats window . eval like the global eval keyword. Regardless, the string is evaluated in the current context, so unscoped identifiers are defined at the global level, but local variables are available, including "this". Moz accepts a second scope parameter to eval. SpiderMonkey (but not Rhino) exposes a "Script" builtin object. Script(str).exec.