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.
 
 
 
 
 
 

35 lines
915 B

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: |
<p>Set multiple number (<code>double</code>) properties into a target object
at <code>obj_index</code>. The number list is given as a list of pairs
(name, number), ending with a pair where the name is <code>NULL</code>.</p>
<p>This is useful e.g. when defining numeric constants for modules or
classes implemented in C.</p>
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