name: duk_peval_string proto: | duk_int_t duk_peval_string(duk_context *ctx, const char *src); stack: | [ ... ] -> [ ... result! ] (if success, return value == 0) [ ... ] -> [ ... err! ] (if failure, return value != 0) summary: |

Like duk_peval(), but the eval input is given as a C string. The filename associated with the temporary eval function is "eval".

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 - protected - string seealso: - duk_peval_string_noresult introduced: 1.0.0