=proto void duk_eval(duk_context *ctx); =stack [ ... source! ] -> [ ... result! ] =summary
Evaluate the Ecmascript source code at the top of the stack, and leave a single
return value on top of the stack. May throw an error, errors are not caught
automatically. The filename associated with the temporary eval function is
automatically provided from the __FILE__
preprocessor define
of the caller.
This is essentially a shortcut for:
int flags = DUK_COMPILE_EVAL; if (duk_is_strict_call(ctx)) { flags |= DUK_COMPILE_STRICT; } duk_push_string(ctx, __FILE__); duk_compile(ctx, flags); duk_call(ctx, 0);
If the eval input is a fixed string, you can also use
duk_eval_string()
.