=proto int duk_get_magic(duk_context *ctx); =summary

Get the 16-bit signed "magic" value associated with a Duktape/C function. If there is no current activation, zero is returned.

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.

If you need an unsigned 16-bit value, simply AND the result:

unsigned int my_flags = ((unsigned int) duk_get_magic(ctx)) & 0xffff;
=example int my_flags = duk_get_magic(ctx); if (my_flags & 0x01) { printf("flag set\n"); } else { printf("flag not set\n"); } =tags omit