diff --git a/website/api/duk_call_method.yaml b/website/api/duk_call_method.yaml index 43cd251c..6a3eb429 100644 --- a/website/api/duk_call_method.yaml +++ b/website/api/duk_call_method.yaml @@ -33,8 +33,8 @@ example: | * and returns 5. */ - duk_push_string(ctx, "function(x,y) { print('this:', this); " - "print(x,y); return x+y; }"); + duk_push_string(ctx, "(function(x,y) { print('this:', this); " + "print(x,y); return x+y; })"); duk_eval(ctx); /* -> [ ... func ] */ duk_push_int(ctx, 123); duk_push_int(ctx, 2); diff --git a/website/api/duk_pcall_method.yaml b/website/api/duk_pcall_method.yaml index dc2ed10b..118774c0 100644 --- a/website/api/duk_pcall_method.yaml +++ b/website/api/duk_pcall_method.yaml @@ -23,8 +23,8 @@ example: | duk_int_t rc; - duk_push_string(ctx, "function(x,y) { print('this:', this); " - "print(x,y); return x+y; }"); + duk_push_string(ctx, "(function(x,y) { print('this:', this); " + "print(x,y); return x+y; })"); duk_eval(ctx); /* -> [ ... func ] */ duk_push_int(ctx, 123); duk_push_int(ctx, 2);