name: duk_is_constructor_call proto: | duk_bool_t duk_is_constructor_call(duk_context *ctx); summary: |
Return non-zero if current function was called as a constructor
(new Foo()
instead of Foo()
); otherwise returns 0.
This call allows a C function to have different behavior for normal and constructor calls (as is the case for many built-in functions).
example: | if (duk_is_constructor_call(ctx)) { printf("called as a constructor\n"); } else { printf("called as a normal function\n"); } tags: - stack introduced: 1.0.0