name: duk_opt_number proto: | duk_double_t duk_opt_number(duk_context *ctx, duk_idx_t idx, duk_double_t def_value); stack: | [ ... val! ... ] summary: |

Get the number value at idx without modifying or coercing the value. If the value is undefined or the index is invalid, def_value default value is returned. In other cases (null or non-matching type) throws an error.

example: | double backoff_multiplier = (double) duk_opt_number(ctx, 2, 1.5); /* default: 1.5 */ tags: - stack introduced: 2.1.0