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.
 
 
 
 
 
 

36 lines
1004 B

name: duk_get_current_magic
proto: |
duk_int_t duk_get_current_magic(duk_context *ctx);
summary: |
<p>Get the 16-bit signed "magic" value associated with the running
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 bitwise AND the result:</p>
<pre class="c-code">
unsigned int my_flags = ((unsigned int) duk_get_current_magic(ctx)) & 0xffffU;
</pre>
example: |
duk_int_t my_flags = duk_get_current_magic(ctx);
if (my_flags & 0x01) {
printf("flag set\n");
} else {
printf("flag not set\n");
}
tags:
- function
- magic
seealso:
- duk_get_magic
- duk_set_magic
introduced: 1.0.0