mirror of https://github.com/svaarala/duktape.git
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.
19 lines
504 B
19 lines
504 B
=proto
|
|
int duk_is_constructor_call(duk_context *ctx);
|
|
|
|
=summary
|
|
<p>Return non-zero if current function was called as a constructor
|
|
(<tt>new Foo()</tt> instead of <tt>Foo()</tt>); otherwise returns 0.</p>
|
|
|
|
<p>This call allows a C function to have different behavior for normal
|
|
and constructor calls (as is the case for many built-in functions).</p>
|
|
|
|
=example
|
|
if (duk_is_constructor_call(ctx)) {
|
|
printf("called as a constructor\n");
|
|
} else {
|
|
printf("called as a normal function\n");
|
|
}
|
|
|
|
=tags
|
|
stack
|
|
|