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.
27 lines
796 B
27 lines
796 B
=proto
|
|
int duk_get_magic(duk_context *ctx);
|
|
|
|
=summary
|
|
<p>Get the 16-bit signed "magic" value associated with a Duktape/C function.
|
|
If there is no current activation, zero is returned.</p>
|
|
|
|
<p>The magic function allows the same Duktape/C function to be used with slightly
|
|
different behavior; behavior flags or other parameters can be passed in the
|
|
magic field. This is less expensive than having behavior related flags or
|
|
properties in the function object as normal properties.</p>
|
|
|
|
<p>If you need an unsigned 16-bit value, simply AND the result:</p>
|
|
<pre class="c-code">
|
|
unsigned int my_flags = ((unsigned int) duk_get_magic(ctx)) & 0xffff;
|
|
</pre>
|
|
|
|
=example
|
|
int my_flags = duk_get_magic(ctx);
|
|
if (my_flags & 0x01) {
|
|
printf("flag set\n");
|
|
} else {
|
|
printf("flag not set\n");
|
|
}
|
|
|
|
=tags
|
|
omit
|
|
|