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.
 
 
 
 
 
 

37 lines
897 B

name: duk_peval_lstring
proto: |
duk_int_t duk_peval_lstring(duk_context *ctx, const char *src, duk_size_t len);
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 with explicit length. The filename associated with the
temporary eval function is <code>"eval"</code>.</p>
<div include="no-string-intern.html" />
example: |
const char *src = /* ... */;
duk_size_t len = /* ... */;
if (duk_peval_lstring(ctx, src, len) != 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_lstring_noresult
introduced: 1.0.0