mirror of https://github.com/svaarala/duktape.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
709 B
27 lines
709 B
=proto
|
|
int duk_peval_string(duk_context *ctx, const char *str);
|
|
|
|
=stack
|
|
[ ... ] -> [ ... result! ] (if success, return value == 0)
|
|
[ ... ] -> [ ... err! ] (if failure, return value != 0)
|
|
|
|
=summary
|
|
<p>Like
|
|
<code><a href="#duk_peval">duk_peval()</a></code>, but the eval input
|
|
is given as a C string. The filename associated with the temporary
|
|
is automatically provided from the <code>__FILE__</code> preprocessor define
|
|
of the caller.</p>
|
|
|
|
=example
|
|
if (duk_peval_string(ctx, "'testString'.toUpperCase()") != 0) {
|
|
printf("eval failed: %s\n", duk_safe_to_string(ctx, -1));
|
|
} else {
|
|
printf("result is: %s\n", duk_get_string(ctx, -1));
|
|
}
|
|
duk_pop(ctx);
|
|
|
|
=tags
|
|
compile
|
|
|
|
=seealso
|
|
duk_peval_string_noresult
|
|
|