name: duk_require_buffer proto: | void *duk_require_buffer(duk_context *ctx, duk_idx_t index, duk_size_t *out_size); stack: | [ ... val! ... ] summary: |

Like duk_get_buffer(), but throws an error if the value at index is not a (plain) buffer or if the index is invalid.

example: | void *ptr; duk_size_t sz; ptr = duk_require_buffer(ctx, -3, &sz); printf("buf=%p, size=%lu\n", ptr, (unsigned long) sz); tags: - stack - buffer seealso: - duk_get_buffer - duk_require_buffer_data - duk_get_buffer_data introduced: 1.0.0