Skip to content

Instantly share code, notes, and snippets.

@muja
Last active August 29, 2015 14:25
Show Gist options
  • Save muja/5f61df530377c5e59f7a to your computer and use it in GitHub Desktop.
Save muja/5f61df530377c5e59f7a to your computer and use it in GitHub Desktop.
ctx = duk_create_heap(None, None, None, ptr::null_mut(), None)
duk_push_string(ctx, "function x() { return '4'; }");
duk_push_string(ctx, "<eval>");
duk_eval_raw(ctx, 0, 0, DUK_COMPILE_FUNCTION);
value = duk_get_string(ctx, 0);
duk_destroy_heap(ctx);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment