name: duk_opt_buffer proto: | void *duk_opt_buffer(duk_context *ctx, duk_idx_t idx, duk_size_t *out_size, void *def_ptr, duk_size_t def_len); stack: | [ ... val! ... ] summary: |
Get the data pointer for a (plain) buffer value at idx
without
modifying or coercing the value. Returns a non-NULL
pointer if the value
is a valid buffer with a non-zero size. For a zero-size buffer, may return a
NULL
or a non-NULL
pointer. If out_size
is
non-NULL
, the size of the buffer is written to *out_size
.
If the value is undefined
or the index is invalid, def_ptr
default value is returned and the def_len
default length is written
to *out_size
(if out_size
is non-NULL
).
In other cases (null
and non-matching type) throws an error.