name: duk_put_number_list proto: | void duk_put_number_list(duk_context *ctx, duk_idx_t obj_index, const duk_number_list_entry *numbers); stack: | [ ... obj! ... ] -> [ ... obj! ... ] summary: |
Set multiple number (double
) properties into a target object
at obj_index
. The number list is given as a list of pairs
(name, number), ending with a pair where the name is NULL
.
This is useful e.g. when defining numeric constants for modules or classes implemented in C.
example: | const duk_number_list_entry my_module_consts[] = { { "FLAG_FOO", (double) (1 << 0) }, { "FLAG_BAR", (double) (1 << 1) }, { "FLAG_QUUX", (double) (1 << 2) }, { "DELAY", 300.0 }, { NULL, 0.0 } }; duk_put_number_list(ctx, -3, my_module_consts); tags: - property - module seealso: - duk_put_function_list introduced: 1.0.0