Skip to content

duk_put_number_list constant? #2567

@ThomasKrenn

Description

@ThomasKrenn

The duk_put_number_list documentation mentions:
This is useful e.g. when defining numeric constants for modules or classes implemented in C.

My tests showed that the properties created with duk_put_number_list are writable.

An alternative I found to create constant module properties:

 duk_push_string(ctx, "key");
 duk_push_uint(ctx, 123);
 duk_def_prop(ctx, -4,     /* put prop in module 'exports' */
       DUK_DEFPROP_HAVE_VALUE | 
            DUK_DEFPROP_HAVE_WRITABLE | DUK_DEFPROP_CLEAR_WRITABLE | 
            DUK_DEFPROP_HAVE_ENUMERABLE | DUK_DEFPROP_ENUMERABLE);

Best regards
Thomas

duk_put_number_list

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions