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

Get a borrowed void * reference to a Duktape heap allocated value (object, buffer, string) at idx. 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: | void *ptr; ptr = duk_opt_heapptr(ctx, 2, default_ptr); tags: - stack - borrowed - heapptr introduced: 2.1.0