=proto int duk_next(duk_context *ctx, int enum_index, int get_value); =stack [ ... enum! ... ] -> [ ... enum! ... ] (if enum empty; function returns zero) [ ... enum! ... ] -> [ ... enum! ... key! ] (if enum not empty and get_value == 0; function returns non-zero) [ ... enum! ... ] -> [ ... enum! ... key! value! ] (if enum not empty and get_value != 0; function returns non-zero) =summary

Get the next key (and optionally value) from an enumerator created with duk_enum(). If the enumeration has been exhausted, nothing is pushed to the stack and the function returns zero. Otherwise the key is pushed to the stack, followed by the value if get_value is non-zero, and the function returns non-zero.

Note that getting the value may invoke a getter which may have arbitrary side effects (and may throw an error).

=example while (duk_next(ctx, enum_idx, 1)) { printf("key=%s, value=%s\n", duk_to_string(ctx, -2), duk_to_string(ctx, -1)); duk_pop_2(ctx); } =tags object property =seealso duk_enum