Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

duk_put_number_list constant? #2567

Open
ThomasKrenn opened this issue May 6, 2024 · 0 comments
Open

duk_put_number_list constant? #2567

ThomasKrenn opened this issue May 6, 2024 · 0 comments

Comments

@ThomasKrenn
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant