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.
 
 
 
 
 
 

25 lines
786 B

=proto
int duk_pcompile_string(duk_context *ctx, int flags, const char *src);
=stack
[ ... ] -> [ ... function! ] (if success, return value == 0)
[ ... ] -> [ ... err! ] (if failure, return value != 0)
=summary
<p>Like
<code><a href="#duk_pcompile">duk_pcompile()</a></code>, but the compile input
is given as a C string. The filename associated with the function is
automatically provided from the <code>__FILE__</code> preprocessor define
of the caller.</p>
=example
if (duk_pcompile_string(ctx, 0, "print('program code'); syntax error here=") != 0) {
printf("compile failed: %s\n", duk_safe_to_string(ctx, -1));
} else {
duk_call(ctx, 0); /* [ func ] -> [ result ] */
printf("program result: %s\n", duk_safe_to_string(ctx, -1));
}
duk_pop(ctx);
=tags
compile